@@ -11,11 +11,11 @@ import {PlotObjectFactory} from "../Shapes/PlotObjectFactory";
1111import { addExtendLayersPlot } from "../../3DPlot/Utils/PlotUtil" ;
1212
1313export default class DrawPoint2D extends DrawObject {
14- constructor ( fabricCanvas , symbol , options ) {
14+ constructor ( plotLayer , symbol , options ) {
1515 super ( ) ;
16- this . m_fabricCanvas = fabricCanvas ;
16+ this . _plotLayer = plotLayer ;
1717 this . m_symbol = symbol ;
18- this . m_coordSys = this . m_fabricCanvas . getCoordSys ( ) ;
18+ this . m_coordSys = this . _plotLayer . getCoordSys ( ) ;
1919 this . onMouseUp = this . innerOnMouseUp . bind ( this ) ;
2020 //绘制完成回调函数
2121 const { addedPlot} = options ;
@@ -24,13 +24,13 @@ export default class DrawPoint2D extends DrawObject {
2424
2525 addHooks ( ) {
2626 super . addHooks ( ) ;
27- this . m_fabricCanvas . on ( "mouse:up" , this . onMouseUp ) ;
28- this . m_fabricCanvas . interactive = false ;
27+ this . _plotLayer . on ( "mouse:up" , this . onMouseUp ) ;
28+ this . _plotLayer . interactive = false ;
2929 }
3030
3131 removeHooks ( ) {
32- this . m_fabricCanvas . interactive = false ;
33- this . m_fabricCanvas . off ( "mouse:up" , this . onMouseUp ) ;
32+ this . _plotLayer . interactive = false ;
33+ this . _plotLayer . off ( "mouse:up" , this . onMouseUp ) ;
3434 super . removeHooks ( ) ;
3535 }
3636
@@ -40,18 +40,18 @@ export default class DrawPoint2D extends DrawObject {
4040 this . m_symbol . getElement ( ) . then ( ( element ) => {
4141 const object = PlotObjectFactory . createInstance ( this . m_symbol . type , {
4242 element :element ,
43- canvas : this . m_fabricCanvas ,
43+ canvas : this . _plotLayer ,
4444 } ) ;
4545
4646 object . setPnts ( [ new Point ( pnt [ 0 ] , pnt [ 1 ] ) ] ) ;
4747
48- this . m_fabricCanvas . add ( object ) ;
49- this . m_fabricCanvas . requestRenderAll ( ) ;
48+ this . _plotLayer . addPlot ( object ) ;
49+ this . _plotLayer . requestRenderAll ( ) ;
5050 this . fireFinishEvent ( { plotObj2D : object } ) ;
5151 if ( this . _addedPlot ) {
5252 this . _addedPlot ( object ) ;
5353 }
54- addExtendLayersPlot ( this . m_fabricCanvas . _linkTool , object ) ;
54+ addExtendLayersPlot ( this . _plotLayer . _linkTool , object ) ;
5555 this . disable ( ) ;
5656 } )
5757
0 commit comments