@inditextech/weave-sdk 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs +279 -35
- package/dist/sdk.d.cts +80 -2
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +80 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +275 -36
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -18102,7 +18102,7 @@ var WeaveRegisterManager = class {
|
|
|
18102
18102
|
|
|
18103
18103
|
//#endregion
|
|
18104
18104
|
//#region package.json
|
|
18105
|
-
var version = "0.
|
|
18105
|
+
var version = "0.23.0";
|
|
18106
18106
|
|
|
18107
18107
|
//#endregion
|
|
18108
18108
|
//#region src/managers/setup.ts
|
|
@@ -20300,14 +20300,14 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
20300
20300
|
} };
|
|
20301
20301
|
}
|
|
20302
20302
|
onRender(props) {
|
|
20303
|
-
const
|
|
20303
|
+
const star = new Konva.Star({
|
|
20304
20304
|
...props,
|
|
20305
20305
|
name: "node",
|
|
20306
20306
|
numPoints: props.numPoints,
|
|
20307
20307
|
innerRadius: props.innerRadius,
|
|
20308
20308
|
outerRadius: props.outerRadius
|
|
20309
20309
|
});
|
|
20310
|
-
|
|
20310
|
+
star.getTransformerProperties = () => {
|
|
20311
20311
|
const stage = this.instance.getStage();
|
|
20312
20312
|
const node = stage.findOne(`#${props.id}`);
|
|
20313
20313
|
if (node && node.getAttrs().keepAspectRatio) return {
|
|
@@ -20322,8 +20322,8 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
20322
20322
|
};
|
|
20323
20323
|
return this.config.transform;
|
|
20324
20324
|
};
|
|
20325
|
-
this.setupDefaultNodeEvents(
|
|
20326
|
-
return
|
|
20325
|
+
this.setupDefaultNodeEvents(star);
|
|
20326
|
+
return star;
|
|
20327
20327
|
}
|
|
20328
20328
|
onUpdate(nodeInstance, nextProps) {
|
|
20329
20329
|
nodeInstance.setAttrs({ ...nextProps });
|
|
@@ -20378,17 +20378,17 @@ var WeaveArrowNode = class extends WeaveNode {
|
|
|
20378
20378
|
}
|
|
20379
20379
|
scaleReset(node) {
|
|
20380
20380
|
if (node.getAttrs().nodeType === "arrow") {
|
|
20381
|
-
const
|
|
20382
|
-
const oldPoints =
|
|
20381
|
+
const arrowNode = node;
|
|
20382
|
+
const oldPoints = arrowNode.points();
|
|
20383
20383
|
const newPoints = [];
|
|
20384
20384
|
for (let i = 0; i < oldPoints.length / 2; i++) {
|
|
20385
20385
|
const point = {
|
|
20386
|
-
x: oldPoints[i * 2] *
|
|
20387
|
-
y: oldPoints[i * 2 + 1] *
|
|
20386
|
+
x: oldPoints[i * 2] * arrowNode.scaleX(),
|
|
20387
|
+
y: oldPoints[i * 2 + 1] * arrowNode.scaleY()
|
|
20388
20388
|
};
|
|
20389
20389
|
newPoints.push(point.x, point.y);
|
|
20390
20390
|
}
|
|
20391
|
-
|
|
20391
|
+
arrowNode.points(newPoints);
|
|
20392
20392
|
}
|
|
20393
20393
|
node.width(Math.max(5, node.width() * node.scaleX()));
|
|
20394
20394
|
node.height(Math.max(5, node.height() * node.scaleY()));
|
|
@@ -20397,6 +20397,64 @@ var WeaveArrowNode = class extends WeaveNode {
|
|
|
20397
20397
|
}
|
|
20398
20398
|
};
|
|
20399
20399
|
|
|
20400
|
+
//#endregion
|
|
20401
|
+
//#region src/nodes/regular-polygon/constants.ts
|
|
20402
|
+
const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
20403
|
+
|
|
20404
|
+
//#endregion
|
|
20405
|
+
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
20406
|
+
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
20407
|
+
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
20408
|
+
constructor(params) {
|
|
20409
|
+
super();
|
|
20410
|
+
const { config } = params ?? {};
|
|
20411
|
+
this.config = { transform: {
|
|
20412
|
+
...WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
20413
|
+
...config?.transform
|
|
20414
|
+
} };
|
|
20415
|
+
}
|
|
20416
|
+
onRender(props) {
|
|
20417
|
+
const regularPolygon = new Konva.RegularPolygon({
|
|
20418
|
+
...props,
|
|
20419
|
+
name: "node",
|
|
20420
|
+
sides: props.sides,
|
|
20421
|
+
radius: props.radius
|
|
20422
|
+
});
|
|
20423
|
+
regularPolygon.getTransformerProperties = () => {
|
|
20424
|
+
return {
|
|
20425
|
+
...this.config.transform,
|
|
20426
|
+
enabledAnchors: [
|
|
20427
|
+
"top-left",
|
|
20428
|
+
"top-right",
|
|
20429
|
+
"bottom-left",
|
|
20430
|
+
"bottom-right"
|
|
20431
|
+
],
|
|
20432
|
+
keepRatio: true
|
|
20433
|
+
};
|
|
20434
|
+
};
|
|
20435
|
+
this.setupDefaultNodeEvents(regularPolygon);
|
|
20436
|
+
return regularPolygon;
|
|
20437
|
+
}
|
|
20438
|
+
onUpdate(nodeInstance, nextProps) {
|
|
20439
|
+
nodeInstance.setAttrs({
|
|
20440
|
+
...nextProps,
|
|
20441
|
+
radius: nextProps.radius
|
|
20442
|
+
});
|
|
20443
|
+
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
20444
|
+
if (nodesSelectionPlugin) {
|
|
20445
|
+
const actualSelectedNodes = nodesSelectionPlugin.getSelectedNodes();
|
|
20446
|
+
nodesSelectionPlugin.setSelectedNodes(actualSelectedNodes);
|
|
20447
|
+
nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
20448
|
+
}
|
|
20449
|
+
}
|
|
20450
|
+
scaleReset(node) {
|
|
20451
|
+
const regularPolygonNode = node;
|
|
20452
|
+
regularPolygonNode.radius(Math.max(5, regularPolygonNode.radius() * regularPolygonNode.scaleX()));
|
|
20453
|
+
node.scaleX(1);
|
|
20454
|
+
node.scaleY(1);
|
|
20455
|
+
}
|
|
20456
|
+
};
|
|
20457
|
+
|
|
20400
20458
|
//#endregion
|
|
20401
20459
|
//#region src/nodes/frame/constants.ts
|
|
20402
20460
|
const WEAVE_FRAME_NODE_TYPE = "frame";
|
|
@@ -20784,6 +20842,12 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
20784
20842
|
const WEAVE_STAGE_ZOOM_KEY = "stageZoom";
|
|
20785
20843
|
const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
20786
20844
|
zoomSteps: [
|
|
20845
|
+
.01,
|
|
20846
|
+
.05,
|
|
20847
|
+
.1,
|
|
20848
|
+
.2,
|
|
20849
|
+
.3,
|
|
20850
|
+
.4,
|
|
20787
20851
|
.5,
|
|
20788
20852
|
.6,
|
|
20789
20853
|
.7,
|
|
@@ -20834,24 +20898,20 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
20834
20898
|
}
|
|
20835
20899
|
onInit() {
|
|
20836
20900
|
this.initEvents();
|
|
20837
|
-
const minimumZoom = this.minimumZoom();
|
|
20838
|
-
if (minimumZoom < this.config.zoomSteps[0]) {
|
|
20839
|
-
this.updatedMinimumZoom = true;
|
|
20840
|
-
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
20841
|
-
}
|
|
20842
20901
|
const mainLayer = this.instance.getMainLayer();
|
|
20843
|
-
|
|
20844
|
-
const minimumZoom
|
|
20845
|
-
if (this.updatedMinimumZoom && minimumZoom
|
|
20902
|
+
const handleDraw = () => {
|
|
20903
|
+
const minimumZoom = this.minimumZoom();
|
|
20904
|
+
if (this.updatedMinimumZoom && minimumZoom < this.config.zoomSteps[0]) {
|
|
20846
20905
|
this.updatedMinimumZoom = true;
|
|
20847
|
-
this.config.zoomSteps
|
|
20848
|
-
this.config.zoomSteps = [minimumZoom
|
|
20906
|
+
const [_, ...restSteps] = this.config.zoomSteps;
|
|
20907
|
+
this.config.zoomSteps = [minimumZoom, ...restSteps];
|
|
20849
20908
|
}
|
|
20850
|
-
if (!this.updatedMinimumZoom && minimumZoom
|
|
20909
|
+
if (!this.updatedMinimumZoom && minimumZoom < this.config.zoomSteps[0]) {
|
|
20851
20910
|
this.updatedMinimumZoom = true;
|
|
20852
|
-
this.config.zoomSteps = [minimumZoom
|
|
20911
|
+
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
20853
20912
|
}
|
|
20854
|
-
}
|
|
20913
|
+
};
|
|
20914
|
+
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
20855
20915
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
20856
20916
|
}
|
|
20857
20917
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -21677,8 +21737,8 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
21677
21737
|
const node = nodeHandler.create(this.ellipseId, {
|
|
21678
21738
|
...this.props,
|
|
21679
21739
|
strokeScaleEnabled: true,
|
|
21680
|
-
x: this.clickPoint?.x ?? 0,
|
|
21681
|
-
y: this.clickPoint?.y ?? 0,
|
|
21740
|
+
x: this.clickPoint?.x ?? 0 + this.props.radiusX,
|
|
21741
|
+
y: this.clickPoint?.y ?? 0 + this.props.radiusY,
|
|
21682
21742
|
radiusX: 0,
|
|
21683
21743
|
radiusY: 0
|
|
21684
21744
|
});
|
|
@@ -21704,8 +21764,8 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
21704
21764
|
}
|
|
21705
21765
|
ellipse.setAttrs({
|
|
21706
21766
|
...this.props,
|
|
21707
|
-
x: ellipsePos.x + ellipseRadiusX
|
|
21708
|
-
y: ellipsePos.y + ellipseRadiusY
|
|
21767
|
+
x: ellipsePos.x + ellipseRadiusX,
|
|
21768
|
+
y: ellipsePos.y + ellipseRadiusY,
|
|
21709
21769
|
radiusX: ellipseRadiusX,
|
|
21710
21770
|
radiusY: ellipseRadiusY
|
|
21711
21771
|
});
|
|
@@ -21730,8 +21790,8 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
21730
21790
|
ellipsePos.y = Math.min(this.clickPoint.y, mousePoint.y);
|
|
21731
21791
|
}
|
|
21732
21792
|
ellipse.setAttrs({
|
|
21733
|
-
x: ellipsePos.x + deltaX
|
|
21734
|
-
y: ellipsePos.y + deltaY
|
|
21793
|
+
x: ellipsePos.x + deltaX,
|
|
21794
|
+
y: ellipsePos.y + deltaY,
|
|
21735
21795
|
radiusX: deltaX,
|
|
21736
21796
|
radiusY: deltaY
|
|
21737
21797
|
});
|
|
@@ -22361,8 +22421,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
22361
22421
|
const node = nodeHandler.create(this.starId, {
|
|
22362
22422
|
...this.props,
|
|
22363
22423
|
strokeScaleEnabled: true,
|
|
22364
|
-
x: this.clickPoint?.x ?? 0,
|
|
22365
|
-
y: this.clickPoint?.y ?? 0,
|
|
22424
|
+
x: this.clickPoint?.x ?? 0 + this.props.outerRadius,
|
|
22425
|
+
y: this.clickPoint?.y ?? 0 + this.props.outerRadius,
|
|
22366
22426
|
numPoints: 5,
|
|
22367
22427
|
innerRadius: 0,
|
|
22368
22428
|
outerRadius: 0
|
|
@@ -22389,8 +22449,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
22389
22449
|
}
|
|
22390
22450
|
star.setAttrs({
|
|
22391
22451
|
...this.props,
|
|
22392
|
-
x: starPos.x + starOuterRadius
|
|
22393
|
-
y: starPos.y + starOuterRadius
|
|
22452
|
+
x: starPos.x + starOuterRadius,
|
|
22453
|
+
y: starPos.y + starOuterRadius,
|
|
22394
22454
|
outerRadius: starOuterRadius,
|
|
22395
22455
|
innerRadius: starInnerRadius
|
|
22396
22456
|
});
|
|
@@ -22415,8 +22475,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
22415
22475
|
starPos.y = Math.min(this.clickPoint.y, mousePoint.y);
|
|
22416
22476
|
}
|
|
22417
22477
|
star.setAttrs({
|
|
22418
|
-
x: starPos.x + deltaX
|
|
22419
|
-
y: starPos.y + deltaX
|
|
22478
|
+
x: starPos.x + deltaX,
|
|
22479
|
+
y: starPos.y + deltaX,
|
|
22420
22480
|
outerRadius: deltaX,
|
|
22421
22481
|
innerRadius: deltaY
|
|
22422
22482
|
});
|
|
@@ -22703,6 +22763,185 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
22703
22763
|
}
|
|
22704
22764
|
};
|
|
22705
22765
|
|
|
22766
|
+
//#endregion
|
|
22767
|
+
//#region src/actions/regular-polygon-tool/constants.ts
|
|
22768
|
+
const REGULAR_POLYGON_TOOL_ACTION_NAME = "regularPolygonTool";
|
|
22769
|
+
const REGULAR_POLYGON_TOOL_STATE = {
|
|
22770
|
+
["IDLE"]: "idle",
|
|
22771
|
+
["ADDING"]: "adding",
|
|
22772
|
+
["DEFINING_SIZE"]: "definingSize",
|
|
22773
|
+
["ADDED"]: "added"
|
|
22774
|
+
};
|
|
22775
|
+
|
|
22776
|
+
//#endregion
|
|
22777
|
+
//#region src/actions/regular-polygon-tool/regular-polygon-tool.ts
|
|
22778
|
+
var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
22779
|
+
initialized = false;
|
|
22780
|
+
onPropsChange = void 0;
|
|
22781
|
+
onInit = void 0;
|
|
22782
|
+
constructor() {
|
|
22783
|
+
super();
|
|
22784
|
+
this.initialized = false;
|
|
22785
|
+
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
22786
|
+
this.regularPolygonId = null;
|
|
22787
|
+
this.creating = false;
|
|
22788
|
+
this.moved = false;
|
|
22789
|
+
this.container = void 0;
|
|
22790
|
+
this.clickPoint = null;
|
|
22791
|
+
this.props = this.initProps();
|
|
22792
|
+
}
|
|
22793
|
+
getName() {
|
|
22794
|
+
return REGULAR_POLYGON_TOOL_ACTION_NAME;
|
|
22795
|
+
}
|
|
22796
|
+
initProps() {
|
|
22797
|
+
return {
|
|
22798
|
+
opacity: 1,
|
|
22799
|
+
fill: "#71717aff",
|
|
22800
|
+
stroke: "#000000ff",
|
|
22801
|
+
strokeWidth: 1,
|
|
22802
|
+
sides: 5,
|
|
22803
|
+
radius: 50
|
|
22804
|
+
};
|
|
22805
|
+
}
|
|
22806
|
+
setupEvents() {
|
|
22807
|
+
const stage = this.instance.getStage();
|
|
22808
|
+
stage.container().addEventListener("keydown", (e) => {
|
|
22809
|
+
if (e.key === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
22810
|
+
this.cancelAction();
|
|
22811
|
+
return;
|
|
22812
|
+
}
|
|
22813
|
+
if (e.key === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
22814
|
+
this.cancelAction();
|
|
22815
|
+
return;
|
|
22816
|
+
}
|
|
22817
|
+
});
|
|
22818
|
+
stage.on("mousedown touchstart", (e) => {
|
|
22819
|
+
e.evt.preventDefault();
|
|
22820
|
+
if (this.state === REGULAR_POLYGON_TOOL_STATE.ADDING) {
|
|
22821
|
+
this.creating = true;
|
|
22822
|
+
this.handleAdding();
|
|
22823
|
+
}
|
|
22824
|
+
});
|
|
22825
|
+
stage.on("mousemove touchmove", (e) => {
|
|
22826
|
+
e.evt.preventDefault();
|
|
22827
|
+
if (this.state === REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE) {
|
|
22828
|
+
this.moved = true;
|
|
22829
|
+
this.handleMovement();
|
|
22830
|
+
}
|
|
22831
|
+
});
|
|
22832
|
+
stage.on("mouseup touchend", (e) => {
|
|
22833
|
+
e.evt.preventDefault();
|
|
22834
|
+
if (this.state === REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE) {
|
|
22835
|
+
this.creating = false;
|
|
22836
|
+
this.handleSettingSize();
|
|
22837
|
+
}
|
|
22838
|
+
});
|
|
22839
|
+
this.initialized = true;
|
|
22840
|
+
}
|
|
22841
|
+
setState(state) {
|
|
22842
|
+
this.state = state;
|
|
22843
|
+
}
|
|
22844
|
+
addRegularPolygon() {
|
|
22845
|
+
const stage = this.instance.getStage();
|
|
22846
|
+
stage.container().style.cursor = "crosshair";
|
|
22847
|
+
stage.container().focus();
|
|
22848
|
+
this.clickPoint = null;
|
|
22849
|
+
this.setState(REGULAR_POLYGON_TOOL_STATE.ADDING);
|
|
22850
|
+
}
|
|
22851
|
+
handleAdding() {
|
|
22852
|
+
const { mousePoint, container } = this.instance.getMousePointer();
|
|
22853
|
+
this.clickPoint = mousePoint;
|
|
22854
|
+
this.container = container;
|
|
22855
|
+
this.regularPolygonId = v4_default();
|
|
22856
|
+
const nodeHandler = this.instance.getNodeHandler("regular-polygon");
|
|
22857
|
+
const node = nodeHandler.create(this.regularPolygonId, {
|
|
22858
|
+
...this.props,
|
|
22859
|
+
strokeScaleEnabled: true,
|
|
22860
|
+
x: (this.clickPoint?.x ?? 0) + this.props.radius,
|
|
22861
|
+
y: (this.clickPoint?.y ?? 0) + this.props.radius,
|
|
22862
|
+
radius: 0
|
|
22863
|
+
});
|
|
22864
|
+
this.instance.addNode(node, this.container?.getAttrs().id);
|
|
22865
|
+
this.setState(REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE);
|
|
22866
|
+
}
|
|
22867
|
+
handleSettingSize() {
|
|
22868
|
+
const regularPolygon = this.instance.getStage().findOne(`#${this.regularPolygonId}`);
|
|
22869
|
+
if (this.regularPolygonId && this.clickPoint && this.container && regularPolygon) {
|
|
22870
|
+
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.container);
|
|
22871
|
+
const nodeHandler = this.instance.getNodeHandler("regular-polygon");
|
|
22872
|
+
const starPos = {
|
|
22873
|
+
x: this.clickPoint.x,
|
|
22874
|
+
y: this.clickPoint.y
|
|
22875
|
+
};
|
|
22876
|
+
let newRadius = this.props.radius;
|
|
22877
|
+
if (this.moved) {
|
|
22878
|
+
starPos.x = Math.min(this.clickPoint.x, mousePoint.x);
|
|
22879
|
+
starPos.y = Math.min(this.clickPoint.y, mousePoint.y);
|
|
22880
|
+
newRadius = Math.abs(this.clickPoint.x - mousePoint.x);
|
|
22881
|
+
}
|
|
22882
|
+
regularPolygon.setAttrs({
|
|
22883
|
+
...this.props,
|
|
22884
|
+
x: starPos.x + newRadius,
|
|
22885
|
+
y: starPos.y + newRadius,
|
|
22886
|
+
radius: newRadius
|
|
22887
|
+
});
|
|
22888
|
+
this.instance.updateNode(nodeHandler.serialize(regularPolygon));
|
|
22889
|
+
}
|
|
22890
|
+
this.cancelAction();
|
|
22891
|
+
}
|
|
22892
|
+
handleMovement() {
|
|
22893
|
+
if (this.state !== REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE) return;
|
|
22894
|
+
const regularPolygon = this.instance.getStage().findOne(`#${this.regularPolygonId}`);
|
|
22895
|
+
if (this.regularPolygonId && this.container && this.clickPoint && regularPolygon) {
|
|
22896
|
+
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.container);
|
|
22897
|
+
const deltaX = Math.abs(mousePoint.x - this.clickPoint?.x);
|
|
22898
|
+
const nodeHandler = this.instance.getNodeHandler("regular-polygon");
|
|
22899
|
+
const starPos = {
|
|
22900
|
+
x: this.clickPoint.x,
|
|
22901
|
+
y: this.clickPoint.y
|
|
22902
|
+
};
|
|
22903
|
+
if (this.moved) {
|
|
22904
|
+
starPos.x = Math.min(this.clickPoint.x, mousePoint.x);
|
|
22905
|
+
starPos.y = Math.min(this.clickPoint.y, mousePoint.y);
|
|
22906
|
+
}
|
|
22907
|
+
regularPolygon.setAttrs({
|
|
22908
|
+
x: starPos.x + deltaX,
|
|
22909
|
+
y: starPos.y + deltaX,
|
|
22910
|
+
radius: deltaX
|
|
22911
|
+
});
|
|
22912
|
+
this.instance.updateNode(nodeHandler.serialize(regularPolygon));
|
|
22913
|
+
}
|
|
22914
|
+
}
|
|
22915
|
+
trigger(cancelAction) {
|
|
22916
|
+
if (!this.instance) throw new Error("Instance not defined");
|
|
22917
|
+
if (!this.initialized) this.setupEvents();
|
|
22918
|
+
const stage = this.instance.getStage();
|
|
22919
|
+
stage.container().tabIndex = 1;
|
|
22920
|
+
stage.container().focus();
|
|
22921
|
+
this.cancelAction = cancelAction;
|
|
22922
|
+
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
22923
|
+
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
22924
|
+
this.props = this.initProps();
|
|
22925
|
+
this.addRegularPolygon();
|
|
22926
|
+
}
|
|
22927
|
+
cleanup() {
|
|
22928
|
+
const stage = this.instance.getStage();
|
|
22929
|
+
stage.container().style.cursor = "default";
|
|
22930
|
+
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
22931
|
+
if (selectionPlugin) {
|
|
22932
|
+
const node = stage.findOne(`#${this.regularPolygonId}`);
|
|
22933
|
+
if (node) selectionPlugin.setSelectedNodes([node]);
|
|
22934
|
+
this.instance.triggerAction(SELECTION_TOOL_ACTION_NAME);
|
|
22935
|
+
}
|
|
22936
|
+
this.regularPolygonId = null;
|
|
22937
|
+
this.creating = false;
|
|
22938
|
+
this.moved = false;
|
|
22939
|
+
this.container = void 0;
|
|
22940
|
+
this.clickPoint = null;
|
|
22941
|
+
this.setState(REGULAR_POLYGON_TOOL_STATE.IDLE);
|
|
22942
|
+
}
|
|
22943
|
+
};
|
|
22944
|
+
|
|
22706
22945
|
//#endregion
|
|
22707
22946
|
//#region src/actions/frame-tool/constants.ts
|
|
22708
22947
|
const FRAME_TOOL_ACTION_NAME = "frameTool";
|
|
@@ -24139,5 +24378,5 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
|
|
|
24139
24378
|
};
|
|
24140
24379
|
|
|
24141
24380
|
//#endregion
|
|
24142
|
-
export { ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_SIZES, WEAVE_FRAME_NODE_SIZES_MULTIPLIER, WEAVE_FRAME_NODE_SIZES_ORIENTATION, WEAVE_FRAME_NODE_SIZES_TYPES, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodeToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
|
24381
|
+
export { ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_SIZES, WEAVE_FRAME_NODE_SIZES_MULTIPLIER, WEAVE_FRAME_NODE_SIZES_ORIENTATION, WEAVE_FRAME_NODE_SIZES_TYPES, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodeToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
|
24143
24382
|
//# sourceMappingURL=sdk.js.map
|