@@ -13,16 +13,18 @@ import 'three/examples/js/lines/LineMaterial';
1313import 'three/examples/js/lines/LineSegmentsGeometry' ;
1414import 'three/examples/js/lines/LineGeometry' ;
1515
16- import { ScaleType , FigureGLView } from './figure' ;
17-
1816import { LinesGLModel } from './LinesGLModel' ;
1917
2018import { Values } from './values' ;
2119
20+ import { ScaleType , initializeBqplotFigure } from './utils' ;
21+
2222export class LinesGLView extends Lines {
2323 async render ( ) {
2424 await super . render ( ) ;
2525
26+ initializeBqplotFigure ( this . parent ) ;
27+
2628 // Create material for markers
2729 this . material = new THREE . LineMaterial ( ) ;
2830 this . material . uniforms . domain_x = { type : '2f' , value : [ 0 , 1 ] } ;
@@ -56,10 +58,8 @@ export class LinesGLView extends Lines {
5658 this . listenTo ( this . model , 'change:x change:y' , this . updateGeometry ) ;
5759 this . listenTo ( this . model , 'change:stroke_width' , this . update_stroke_width ) ;
5860
59- this . updateScene ( ) ;
60- this . listenTo ( this . parent , 'margin_updated' , ( ) => {
61- this . updateScene ( ) ;
62- } ) ;
61+ this . parent . extras . webGLMarks . push ( this ) ;
62+ this . parent . extras . webGLRequestRender ( ) ;
6363 }
6464
6565 beforeCompile ( shader ) {
@@ -124,11 +124,11 @@ export class LinesGLView extends Lines {
124124 ) ;
125125 this . geometry . setPositions ( current . array_vec3 [ 'position' ] ) ;
126126
127- this . updateScene ( ) ;
127+ this . parent . extras . webGLRequestRender ( ) ;
128128 }
129129
130130 update_line_xy ( animate : boolean ) {
131- this . updateScene ( ) ;
131+ this . parent . extras . webGLRequestRender ( ) ;
132132 }
133133
134134 update_style ( ) {
@@ -140,12 +140,12 @@ export class LinesGLView extends Lines {
140140 } else {
141141 this . material . uniforms . opacity . value = 1 ;
142142 }
143- this . updateScene ( ) ;
143+ this . parent . extras . webGLRequestRender ( ) ;
144144 }
145145
146146 update_stroke_width ( ) {
147147 this . material . linewidth = this . model . get ( 'stroke_width' ) ;
148- this . updateScene ( ) ;
148+ this . parent . extras . webGLRequestRender ( ) ;
149149 }
150150
151151 updateMaterialScales ( ) {
@@ -182,15 +182,8 @@ export class LinesGLView extends Lines {
182182 ] ;
183183 this . updateMaterialScales ( ) ;
184184
185- fig . renderer . render ( this . scene , fig . camera ) ;
186- }
187-
188- updateScene ( ) {
189- this . parent . update_gl ( ) ;
190- }
191-
192- relayout ( ) {
193- this . updateScene ( ) ;
185+ const { renderer, camera } = fig . extras . webGLRenderer ;
186+ renderer . render ( this . scene , camera ) ;
194187 }
195188
196189 draw ( animate ) { }
@@ -202,6 +195,4 @@ export class LinesGLView extends Lines {
202195 scene : THREE . Scene ;
203196
204197 model : LinesGLModel ;
205-
206- parent : FigureGLView ;
207198}
0 commit comments