区段变换数据
This commit is contained in:
parent
13bbc1a7e6
commit
f22953f3f2
@ -47,6 +47,9 @@ export class Section extends JlGraphic implements ILineGraphic {
|
||||
this.labelGraphic.setVectorFontSize(14);
|
||||
this.labelGraphic.anchor.set(0.5);
|
||||
this.labelGraphic.style.fill = '#0f0';
|
||||
this.labelGraphic.transformSave = true;
|
||||
this.labelGraphic.name = 'label';
|
||||
this.transformSave = true;
|
||||
this.addChild(this.lineGraphic);
|
||||
this.addChild(this.labelGraphic);
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import {
|
||||
ChildTransform,
|
||||
DraggablePoint,
|
||||
GraphicApp,
|
||||
GraphicDrawAssistant,
|
||||
GraphicInteractionPlugin,
|
||||
GraphicTransform,
|
||||
GraphicTransformEvent,
|
||||
JlDrawApp,
|
||||
JlGraphic,
|
||||
@ -86,6 +88,20 @@ export class SectionDraw extends GraphicDrawAssistant<
|
||||
prepareData(data: ISectionData): boolean {
|
||||
data.points = this.points;
|
||||
data.code = 'G000';
|
||||
data.childTransforms?.push(
|
||||
new ChildTransform(
|
||||
'label',
|
||||
new GraphicTransform(
|
||||
{
|
||||
x: data.points[1].x - data.points[0].x,
|
||||
y: data.points[1].y - data.points[0].y + 20,
|
||||
},
|
||||
{ x: 0, y: 0 },
|
||||
0,
|
||||
{ x: 0, y: 0 }
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -215,8 +231,6 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
|
||||
g.labelGraphic.eventMode = 'static';
|
||||
g.labelGraphic.cursor = 'pointer';
|
||||
g.labelGraphic.draggable = true;
|
||||
g.labelGraphic.transformSave = true;
|
||||
g.labelGraphic.name = 'label';
|
||||
g.on('selected', this.onSelected, this);
|
||||
g.on('unselected', this.onUnselected, this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user