Skip to content

Commit ddfbdf7

Browse files
committed
【SDK】【增加空画布的处理】
1 parent 035c27e commit ddfbdf7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/service/2DPlot/PlotLayer2D.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class PlotLayer2D {
118118
off(eventName) {
119119
this._eventHandlers.forEach((s) => {
120120
if (s.eventName === eventName) {
121-
this._fabricCanvas.off(s.eventName, s.handler);
121+
this._fabricCanvas && this._fabricCanvas.off(s.eventName, s.handler);
122122
}
123123
});
124124
}
@@ -278,10 +278,10 @@ class PlotLayer2D {
278278
const symbolManager = SymbolManager.instance;
279279

280280
const leaf = symbolManager.getLeafByID(id);
281-
if(!leaf) return null;
281+
if (!leaf) return null;
282282

283283
const element = await leaf.getElement();
284-
if(!element) return null
284+
if (!element) return null;
285285
const plotObj = PlotObjectFactory.createInstance(element.type, {
286286
element,
287287
positions: element.positions,
@@ -435,7 +435,7 @@ class PlotLayer2D {
435435
* @description: 请求渲染
436436
*/
437437
requestRenderAll() {
438-
this._fabricCanvas.requestRenderAll();
438+
this._fabricCanvas && this._fabricCanvas.requestRenderAll();
439439
}
440440
}
441441

0 commit comments

Comments
 (0)