Skip to content

Commit

Permalink
fix(drawing): fix remove drawing elements the control when not remove… (
Browse files Browse the repository at this point in the history
#3873)

Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
2 people authored and Gggpound committed Oct 30, 2024
1 parent dd50d8b commit 25dd7d3
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions packages/engine-render/src/scene.transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,17 @@ export class Transformer extends Disposable implements ITransformerConfig {
this._clearControl$.next(changeSelf);
}

/**
* @description Clear the control of the object with the specified id
* @param {string[]} ids the id of the object to be cleared
*/
public clearControlByIds(ids: string[]) {
for (const id of ids) {
this._selectedObjectMap.delete(id);
}
this.refreshControls();
}

private _clearControlMap() {
this._transformerControlMap.forEach((control) => {
control.dispose();
Expand Down Expand Up @@ -1568,7 +1579,6 @@ export class Transformer extends Disposable implements ITransformerConfig {
const { left, top } = this._getRotateAnchorPosition(TransformerManagerType.ROTATE, height, width, applyObject);

const cursor = this._getRotateAnchorCursor(TransformerManagerType.ROTATE);

const rotate = new Rect(`${TransformerManagerType.ROTATE}_${zIndex}`, {
zIndex: zIndex - 1, left, top, height: rotateSize, width: rotateSize,
radius: rotateCornerRadius, strokeWidth: borderStrokeWidth * 2, stroke: borderStroke,
Expand All @@ -1591,7 +1601,6 @@ export class Transformer extends Disposable implements ITransformerConfig {
} else {
anchor = this._createCopperResizeAnchor(type, applyObject, zIndex);
}

this._attachEventToAnchor(anchor, type, applyObject);
groupElements.push(anchor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,26 @@ export class SheetCanvasFloatDomManagerService extends Disposable {
});
})
);

// remove float-dom control when drawing removed
this.disposeWithMe(
this._drawingManagerService.remove$.subscribe((params) => {
(params).forEach((param) => {
const { unitId, subUnitId, drawingId } = param;
const rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId });

const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
if (renderObject == null) {
return;
}
const { transformer, scene } = renderObject;
const rectShape = scene.getObject(rectShapeKey);
if (rectShape?.oKey) {
transformer.clearControlByIds([rectShape?.oKey]);
}
});
})
);
}

private _scrollUpdateListener() {
Expand Down

0 comments on commit 25dd7d3

Please sign in to comment.