File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ class PlotLayer3D extends Observable {
4242 this . _isDrawing = false ;
4343
4444 //常驻点击事件,针对vue组件做出的修改
45- const handler = new Cesium . ScreenSpaceEventHandler ( viewer . canvas ) ;
46- handler . setInputAction ( ( event ) => {
45+ this . _handler = new Cesium . ScreenSpaceEventHandler ( viewer . canvas ) ;
46+ this . _handler . setInputAction ( ( event ) => {
4747 if ( ! that . _isDrawing && that . _pickPlot ) {
4848 const pick = viewer . scene . pick ( event . position ) ;
4949 if ( pick && pick . primitive && pick . primitive . pickedPrimitive ) {
@@ -334,7 +334,17 @@ Object.defineProperties(PlotLayer3D.prototype, {
334334 return this . _pickEventType ;
335335 } ,
336336 set : function ( value ) {
337+ let that = this ;
338+ this . _handler . removeInputAction ( this . _pickEventType ) ;
337339 this . _pickEventType = value ;
340+ this . _handler . setInputAction ( ( event ) => {
341+ if ( ! that . _isDrawing && that . _pickPlot ) {
342+ const pick = viewer . scene . pick ( event . position ) ;
343+ if ( pick && pick . primitive && pick . primitive . pickedPrimitive ) {
344+ that . _pickPlot ( pick . primitive . pickedPrimitive )
345+ }
346+ }
347+ } , this . _pickEventType ) ;
338348 }
339349 }
340350} ) ;
You can’t perform that action at this time.
0 commit comments