Skip to content

Commit 3d08d8e

Browse files
committed
【杨琨】【添加二三维联动-绘制功能】
1 parent ebdab79 commit 3d08d8e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/service/2DPlot/Draw/DrawPolyline2D.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import {addExtendLayersPlot} from "../../3DPlot/Utils/PlotUtil";
1212

1313
const _ = require('lodash');
1414
export default class DrawPolyline2D extends DrawObject {
15-
constructor(fabricCanvas, symbol, options) {
15+
constructor(plotLayer, symbol, options) {
1616
super();
17-
this.m_fabricCanvas = fabricCanvas;
17+
this._plotLayer = plotLayer;
1818
this.m_symbol = symbol;
19-
this.m_coordSys = this.m_fabricCanvas.getCoordSys();
19+
this.m_coordSys = this._plotLayer.getCoordSys();
2020
this.m_object = null;
2121
this.m_coords = [[0, 0]];
2222
this.onMouseUp = this.innerOnMouseUp.bind(this);
@@ -28,17 +28,17 @@ export default class DrawPolyline2D extends DrawObject {
2828

2929
addHooks() {
3030
super.addHooks();
31-
this.m_fabricCanvas.on('mouse:move', this.onMouseMove);
32-
this.m_fabricCanvas.on('mouse:up', this.onMouseUp);
33-
this.m_fabricCanvas.interactive = false;
31+
this._plotLayer.on('mouse:move', this.onMouseMove);
32+
this._plotLayer.on('mouse:up', this.onMouseUp);
33+
this._plotLayer.interactive = false;
3434
}
3535

3636
removeHooks() {
3737
this.m_object = null;
38-
this.m_fabricCanvas.interactive = true;
39-
this.m_fabricCanvas.off('mouse:move', this.onMouseMove);
40-
this.m_fabricCanvas.off('mouse:up', this.onMouseUp);
41-
this.m_fabricCanvas._isDrawing = false;
38+
this._plotLayer.interactive = true;
39+
this._plotLayer.off('mouse:move', this.onMouseMove);
40+
this._plotLayer.off('mouse:up', this.onMouseUp);
41+
this._plotLayer._isDrawing = false;
4242
super.removeHooks();
4343
}
4444

@@ -47,7 +47,7 @@ export default class DrawPolyline2D extends DrawObject {
4747
this.m_coords[this.m_coords.length - 1] = new Point(pnt[0], pnt[1]);
4848
if (this.m_coords.length >= 2 && this.m_object) {
4949
this.m_object.setPnts(this.m_coords);
50-
this.m_fabricCanvas.requestRenderAll();
50+
this._plotLayer.requestRenderAll();
5151
}
5252
}
5353

@@ -71,15 +71,15 @@ export default class DrawPolyline2D extends DrawObject {
7171
this.m_symbol.getElement().then((element) => {
7272
this.m_object = PlotObjectFactory.createInstance(this.m_symbol.type, {
7373
element: element,
74-
canvas: this.m_fabricCanvas
74+
canvas: this._plotLayer
7575
});
76-
this.m_fabricCanvas.addPlot(this.m_object);
77-
this.m_fabricCanvas._isDrawing = true;
78-
addExtendLayersPlot(this.m_fabricCanvas._linkTool, this.m_object);
76+
this._plotLayer.addPlot(this.m_object);
77+
this._plotLayer._isDrawing = true;
78+
addExtendLayersPlot(this._plotLayer._linkTool, this.m_object);
7979
});
8080
}
8181
}
8282

83-
this.m_fabricCanvas.requestRenderAll();
83+
this._plotLayer.requestRenderAll();
8484
}
8585
}

0 commit comments

Comments
 (0)