esbCode可移动
This commit is contained in:
parent
17bf2350f2
commit
741d7c0a12
@ -54,6 +54,7 @@ export class EsbButton extends JlGraphic {
|
|||||||
this.addChild(this.rectBody);
|
this.addChild(this.rectBody);
|
||||||
this.addChild(this.lineBody);
|
this.addChild(this.lineBody);
|
||||||
this.addChild(this.circleBody);
|
this.addChild(this.circleBody);
|
||||||
|
this.codeGraph.name = 'esb_code';
|
||||||
}
|
}
|
||||||
get datas(): IEsbButtonData {
|
get datas(): IEsbButtonData {
|
||||||
return this.getDatas<IEsbButtonData>();
|
return this.getDatas<IEsbButtonData>();
|
||||||
@ -70,7 +71,17 @@ export class EsbButton extends JlGraphic {
|
|||||||
codeGraph.style.fill = esbButtonConsts.codeColor;
|
codeGraph.style.fill = esbButtonConsts.codeColor;
|
||||||
codeGraph.setVectorFontSize(esbButtonConsts.codeFontSize);
|
codeGraph.setVectorFontSize(esbButtonConsts.codeFontSize);
|
||||||
codeGraph.anchor.set(0.5);
|
codeGraph.anchor.set(0.5);
|
||||||
|
const codeTransform = this.datas?.childTransforms?.find(
|
||||||
|
(item) => item.name === 'esb_code'
|
||||||
|
);
|
||||||
|
if (codeTransform) {
|
||||||
|
const position = codeTransform?.transform.position;
|
||||||
|
const rotation = codeTransform?.transform?.rotation;
|
||||||
|
codeGraph.position.set(position?.x, position?.y);
|
||||||
|
codeGraph.rotation = rotation || 0;
|
||||||
|
} else {
|
||||||
codeGraph.position.set(-30, 0);
|
codeGraph.position.set(-30, 0);
|
||||||
|
}
|
||||||
this.circleBody.clear();
|
this.circleBody.clear();
|
||||||
this.circleBody.beginFill(
|
this.circleBody.beginFill(
|
||||||
this.state.down
|
this.state.down
|
||||||
|
@ -98,12 +98,22 @@ export class EsbButtonInteraction extends GraphicInteractionPlugin<EsbButton> {
|
|||||||
g.cursor = 'pointer';
|
g.cursor = 'pointer';
|
||||||
g.scalable = true;
|
g.scalable = true;
|
||||||
g.rotatable = true;
|
g.rotatable = true;
|
||||||
|
g.codeGraph.draggable = true;
|
||||||
|
g.codeGraph.selectable = true;
|
||||||
|
g.codeGraph.rotatable = true;
|
||||||
|
g.codeGraph.transformSave = true;
|
||||||
|
g.codeGraph.eventMode = 'static';
|
||||||
g.on('transformstart', this.transformstart, this);
|
g.on('transformstart', this.transformstart, this);
|
||||||
}
|
}
|
||||||
unbind(g: EsbButton): void {
|
unbind(g: EsbButton): void {
|
||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.scalable = false;
|
g.scalable = false;
|
||||||
g.rotatable = false;
|
g.rotatable = false;
|
||||||
|
g.codeGraph.draggable = false;
|
||||||
|
g.codeGraph.selectable = false;
|
||||||
|
g.codeGraph.rotatable = false;
|
||||||
|
g.codeGraph.transformSave = false;
|
||||||
|
g.codeGraph.eventMode = 'none';
|
||||||
g.off('transformstart', this.transformstart, this);
|
g.off('transformstart', this.transformstart, this);
|
||||||
}
|
}
|
||||||
transformstart(e: GraphicTransformEvent) {
|
transformstart(e: GraphicTransformEvent) {
|
||||||
|
@ -127,6 +127,11 @@ export class ZdwxEsbInteraction extends GraphicInteractionPlugin<ZdwxEsb> {
|
|||||||
g.cursor = 'pointer';
|
g.cursor = 'pointer';
|
||||||
g.scalable = true;
|
g.scalable = true;
|
||||||
g.rotatable = true;
|
g.rotatable = true;
|
||||||
|
g.codeGraph.draggable = true;
|
||||||
|
g.codeGraph.selectable = true;
|
||||||
|
g.codeGraph.rotatable = true;
|
||||||
|
g.codeGraph.transformSave = true;
|
||||||
|
g.codeGraph.eventMode = 'static';
|
||||||
g.circleBody.hitArea = new EsbBodyHitArea(g);
|
g.circleBody.hitArea = new EsbBodyHitArea(g);
|
||||||
g.on('transformstart', this.transformstart, this);
|
g.on('transformstart', this.transformstart, this);
|
||||||
}
|
}
|
||||||
@ -134,6 +139,11 @@ export class ZdwxEsbInteraction extends GraphicInteractionPlugin<ZdwxEsb> {
|
|||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.scalable = false;
|
g.scalable = false;
|
||||||
g.rotatable = false;
|
g.rotatable = false;
|
||||||
|
g.codeGraph.draggable = false;
|
||||||
|
g.codeGraph.selectable = false;
|
||||||
|
g.codeGraph.rotatable = false;
|
||||||
|
g.codeGraph.transformSave = false;
|
||||||
|
g.codeGraph.eventMode = 'none';
|
||||||
g.off('transformstart', this.transformstart, this);
|
g.off('transformstart', this.transformstart, this);
|
||||||
}
|
}
|
||||||
transformstart(e: GraphicTransformEvent) {
|
transformstart(e: GraphicTransformEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user