Browse Source

refactor: remove unused guidesTarget variable and optimize guide rendering during drag

carlos/505-improve-grapesjs-absolute-mode
Carlos 11 months ago
parent
commit
2d53092a5c
  1. 5
      packages/core/src/commands/view/ComponentDrag.ts

5
packages/core/src/commands/view/ComponentDrag.ts

@ -340,7 +340,7 @@ export default {
}, },
onStart(event) { onStart(event) {
const { target, editor, isTran, opts, guidesTarget } = this; const { target, editor, isTran, opts } = this;
const { Canvas } = editor!; const { Canvas } = editor!;
const style = target?.getStyle(); const style = target?.getStyle();
const position = 'absolute'; const position = 'absolute';
@ -389,11 +389,10 @@ export default {
onDrag() { onDrag() {
const { guidesTarget, opts } = this; const { guidesTarget, opts } = this;
const guidesTargetActive = guidesTarget?.filter((item) => item.active) ?? [];
this.updateGuides(guidesTarget); this.updateGuides(guidesTarget);
opts?.debug && guidesTarget?.forEach((item) => this.renderGuide(item)); opts?.debug && guidesTarget?.forEach((item) => this.renderGuide(item));
opts?.guidesInfo && this.renderGuideInfo(guidesTargetActive); opts?.guidesInfo && this.renderGuideInfo(guidesTarget?.filter((item) => item.active) ?? []);
opts?.onDrag?.(this._getDragData()); opts?.onDrag?.(this._getDragData());
}, },

Loading…
Cancel
Save