This commit is contained in:
fan 2023-06-09 17:44:06 +08:00
commit 988599cd62
3 changed files with 21 additions and 19 deletions

View File

@ -66,12 +66,12 @@ export class IscsFanInteraction extends GraphicInteractionPlugin<IscsFan> {
bind(g: IscsFan): void { bind(g: IscsFan): void {
g.eventMode = 'static'; g.eventMode = 'static';
g.cursor = 'pointer'; g.cursor = 'pointer';
g.scalable = true; // g.scalable = true;
g.rotatable = true; g.rotatable = true;
} }
unbind(g: IscsFan): void { unbind(g: IscsFan): void {
g.eventMode = 'none'; g.eventMode = 'none';
g.scalable = false; // g.scalable = false;
g.rotatable = false; g.rotatable = false;
} }
} }

View File

@ -156,7 +156,9 @@ function buildAbsorbablePositions(rect: Rect): AbsorbablePosition[] {
return; return;
} }
other.linePoints.forEach((point) => { other.linePoints.forEach((point) => {
const absorbablePoint = new AbsorbablePoint(point); const absorbablePoint = new AbsorbablePoint(
other.localToCanvasPoint(point)
);
aps.push(absorbablePoint); aps.push(absorbablePoint);
}); });
}); });

View File

@ -187,7 +187,7 @@ export class GraphicTransformPlugin extends InteractionPluginBase {
this.app.on('graphicselectedchange', this.onGraphicSelectedChange, this); this.app.on('graphicselectedchange', this.onGraphicSelectedChange, this);
this.app.on( this.app.on(
'graphicchildselectedchange', 'graphicchildselectedchange',
this.onGraphicChildSelectedChange, this.onGraphicSelectedChange,
this this
); );
} }
@ -198,7 +198,7 @@ export class GraphicTransformPlugin extends InteractionPluginBase {
this.app.off('graphicselectedchange', this.onGraphicSelectedChange, this); this.app.off('graphicselectedchange', this.onGraphicSelectedChange, this);
this.app.off( this.app.off(
'graphicchildselectedchange', 'graphicchildselectedchange',
this.onGraphicChildSelectedChange, this.onGraphicSelectedChange,
this this
); );
} }
@ -335,7 +335,7 @@ export class GraphicTransformPlugin extends InteractionPluginBase {
br.visible = false; br.visible = false;
} }
} }
if (g.scalable) { if (g.scalable || g.rotatable) {
// 缩放点 // 缩放点
let sp = g.getAssistantAppend<TransformPoints>(TransformPoints.Name); let sp = g.getAssistantAppend<TransformPoints>(TransformPoints.Name);
if (!sp) { if (!sp) {
@ -350,19 +350,19 @@ export class GraphicTransformPlugin extends InteractionPluginBase {
} }
} }
onGraphicChildSelectedChange(child: DisplayObject, selected: boolean) { // onGraphicChildSelectedChange(child: DisplayObject, selected: boolean) {
let br = child.getAssistantAppend<BoundsGraphic>(BoundsGraphic.Name); // let br = child.getAssistantAppend<BoundsGraphic>(BoundsGraphic.Name);
if (!br) { // if (!br) {
// 绘制辅助包围框 // // 绘制辅助包围框
br = new BoundsGraphic(child); // br = new BoundsGraphic(child);
} // }
if (selected) { // if (selected) {
br.redraw(); // br.redraw();
br.visible = true; // br.visible = true;
} else { // } else {
br.visible = false; // br.visible = false;
} // }
} // }
} }
/** /**