@inditextech/weave-sdk 0.16.0 → 0.16.2
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 +95 -150
- package/dist/sdk.d.cts +1 -3
- package/dist/sdk.d.ts +1 -3
- package/dist/sdk.js +97 -150
- package/package.json +2 -2
package/dist/sdk.cjs
CHANGED
|
@@ -15794,7 +15794,6 @@ function moveNodeToContainer(instance, node) {
|
|
|
15794
15794
|
//#endregion
|
|
15795
15795
|
//#region src/plugins/users-selection/constants.ts
|
|
15796
15796
|
const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
15797
|
-
const WEAVE_USERS_SELECTION_LAYER_ID = "usersPointersLayer";
|
|
15798
15797
|
const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
15799
15798
|
|
|
15800
15799
|
//#endregion
|
|
@@ -17920,7 +17919,7 @@ var WeaveRegisterManager = class {
|
|
|
17920
17919
|
|
|
17921
17920
|
//#endregion
|
|
17922
17921
|
//#region package.json
|
|
17923
|
-
var version = "0.16.
|
|
17922
|
+
var version = "0.16.2";
|
|
17924
17923
|
|
|
17925
17924
|
//#endregion
|
|
17926
17925
|
//#region src/managers/setup.ts
|
|
@@ -18947,9 +18946,11 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
18947
18946
|
tr.hide();
|
|
18948
18947
|
}
|
|
18949
18948
|
const textPosition = textNode.absolutePosition();
|
|
18949
|
+
const stageContainer = stage.container();
|
|
18950
|
+
const stageRect = stageContainer.getBoundingClientRect();
|
|
18950
18951
|
const areaPosition = {
|
|
18951
|
-
x:
|
|
18952
|
-
y:
|
|
18952
|
+
x: stageRect.x + stageContainer.offsetLeft + textPosition.x,
|
|
18953
|
+
y: stageRect.y + stageContainer.offsetTop + textPosition.y
|
|
18953
18954
|
};
|
|
18954
18955
|
this.createTextAreaDOM(textNode, areaPosition);
|
|
18955
18956
|
}
|
|
@@ -21636,7 +21637,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21636
21637
|
return WEAVE_USERS_SELECTION_KEY;
|
|
21637
21638
|
}
|
|
21638
21639
|
getLayerName() {
|
|
21639
|
-
return
|
|
21640
|
+
return __inditextech_weave_types.WEAVE_AWARENESS_LAYER_ID;
|
|
21640
21641
|
}
|
|
21641
21642
|
initLayer() {
|
|
21642
21643
|
const stage = this.instance.getStage();
|
|
@@ -21651,7 +21652,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21651
21652
|
}
|
|
21652
21653
|
getLayer() {
|
|
21653
21654
|
const stage = this.instance.getStage();
|
|
21654
|
-
return stage.findOne(`#${
|
|
21655
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21655
21656
|
}
|
|
21656
21657
|
onInit() {
|
|
21657
21658
|
this.instance.addEventListener("onAwarenessChange", (changes) => {
|
|
@@ -21671,17 +21672,6 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21671
21672
|
};
|
|
21672
21673
|
}
|
|
21673
21674
|
}
|
|
21674
|
-
const allActiveUsersSelections = Object.keys(this.usersSelection).map((userSelectionKey) => {
|
|
21675
|
-
const selectionInfo = this.usersSelection[userSelectionKey];
|
|
21676
|
-
return selectionInfo.actualNodes.user;
|
|
21677
|
-
});
|
|
21678
|
-
const inactiveSelections = import_lodash.default.differenceWith(allActiveUsersSelections, allActiveUsers, import_lodash.default.isEqual);
|
|
21679
|
-
const selectionsLayer = this.getLayer();
|
|
21680
|
-
for (const inactiveSelection of inactiveSelections) {
|
|
21681
|
-
const userPointerNode = selectionsLayer?.findOne(`#${inactiveSelection}`);
|
|
21682
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21683
|
-
delete this.usersSelection[inactiveSelection];
|
|
21684
|
-
}
|
|
21685
21675
|
this.renderSelectors();
|
|
21686
21676
|
});
|
|
21687
21677
|
this.renderSelectors();
|
|
@@ -21748,51 +21738,33 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21748
21738
|
for (const selector of selectors) selector.destroy();
|
|
21749
21739
|
for (const userPointerKey of Object.keys(this.usersSelection)) {
|
|
21750
21740
|
const userSelector = this.usersSelection[userPointerKey];
|
|
21751
|
-
const
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
selectorsLayer?.add(userSelectorNode$1);
|
|
21776
|
-
continue;
|
|
21777
|
-
}
|
|
21778
|
-
const userSelectorRect = selectorsLayer?.findOne(`#selector_${userSelector.actualNodes.user}_rect`);
|
|
21779
|
-
if (userSelectorRect) {
|
|
21780
|
-
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21781
|
-
userSelectorNode.setAttrs({
|
|
21782
|
-
x: selectionRect.x,
|
|
21783
|
-
y: selectionRect.y,
|
|
21784
|
-
width: selectionRect.width,
|
|
21785
|
-
height: selectionRect.height,
|
|
21786
|
-
scale: 1
|
|
21787
|
-
});
|
|
21788
|
-
userSelectorRect.setAttrs({
|
|
21789
|
-
x: 0,
|
|
21790
|
-
y: 0,
|
|
21791
|
-
width: selectionRect.width,
|
|
21792
|
-
height: selectionRect.height
|
|
21793
|
-
});
|
|
21794
|
-
}
|
|
21741
|
+
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21742
|
+
const userSelectorNode = new konva.default.Group({
|
|
21743
|
+
name: "selector",
|
|
21744
|
+
id: `selector_${userSelector.actualNodes.user}`,
|
|
21745
|
+
x: selectionRect.x,
|
|
21746
|
+
y: selectionRect.y,
|
|
21747
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21748
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21749
|
+
listening: false
|
|
21750
|
+
});
|
|
21751
|
+
userSelectorNode.moveToBottom();
|
|
21752
|
+
const userSelectorRect = new konva.default.Rect({
|
|
21753
|
+
x: 0,
|
|
21754
|
+
y: 0,
|
|
21755
|
+
id: `selector_${userSelector.actualNodes.user}_rect`,
|
|
21756
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21757
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21758
|
+
fill: "transparent",
|
|
21759
|
+
stroke: this.stringToColor(userSelector.actualNodes.user),
|
|
21760
|
+
strokeWidth: 3,
|
|
21761
|
+
strokeScaleEnabled: false
|
|
21762
|
+
});
|
|
21763
|
+
userSelectorNode.add(userSelectorRect);
|
|
21764
|
+
selectorsLayer?.add(userSelectorNode);
|
|
21795
21765
|
}
|
|
21766
|
+
const pointers = selectorsLayer?.find(".pointer") ?? [];
|
|
21767
|
+
for (const pointer of pointers) pointer.moveToTop();
|
|
21796
21768
|
}
|
|
21797
21769
|
enable() {
|
|
21798
21770
|
this.getLayer()?.show();
|
|
@@ -21807,7 +21779,6 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21807
21779
|
//#endregion
|
|
21808
21780
|
//#region src/plugins/users-pointers/constants.ts
|
|
21809
21781
|
const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
21810
|
-
const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
21811
21782
|
const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
21812
21783
|
const WEAVE_DEFAULT_USER_INFO_FUNCTION = () => ({
|
|
21813
21784
|
name: "Unknown",
|
|
@@ -21845,7 +21816,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21845
21816
|
return WEAVE_USERS_POINTERS_KEY;
|
|
21846
21817
|
}
|
|
21847
21818
|
getLayerName() {
|
|
21848
|
-
return
|
|
21819
|
+
return __inditextech_weave_types.WEAVE_AWARENESS_LAYER_ID;
|
|
21849
21820
|
}
|
|
21850
21821
|
initLayer() {
|
|
21851
21822
|
const stage = this.instance.getStage();
|
|
@@ -21860,7 +21831,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21860
21831
|
}
|
|
21861
21832
|
getLayer() {
|
|
21862
21833
|
const stage = this.instance.getStage();
|
|
21863
|
-
return stage.findOne(`#${
|
|
21834
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21864
21835
|
}
|
|
21865
21836
|
onInit() {
|
|
21866
21837
|
const store = this.instance.getStore();
|
|
@@ -21883,17 +21854,6 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21883
21854
|
};
|
|
21884
21855
|
}
|
|
21885
21856
|
}
|
|
21886
|
-
const allActiveUsersPointers = Object.keys(this.usersPointers).map((userPointerKey) => {
|
|
21887
|
-
const pointerInfo = this.usersPointers[userPointerKey];
|
|
21888
|
-
return pointerInfo.actualPos.user;
|
|
21889
|
-
});
|
|
21890
|
-
const inactivePointers = import_lodash.default.differenceWith(allActiveUsersPointers, allActiveUsers, import_lodash.default.isEqual);
|
|
21891
|
-
const pointersLayer = this.getLayer();
|
|
21892
|
-
for (const inactivePointer of inactivePointers) {
|
|
21893
|
-
const userPointerNode = pointersLayer?.findOne(`#pointer_${inactivePointer}`);
|
|
21894
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21895
|
-
delete this.usersPointers[inactivePointer];
|
|
21896
|
-
}
|
|
21897
21857
|
this.renderPointers();
|
|
21898
21858
|
});
|
|
21899
21859
|
stage.on("dragmove", (e) => {
|
|
@@ -21942,85 +21902,72 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21942
21902
|
const stage = this.instance.getStage();
|
|
21943
21903
|
const pointersLayer = this.getLayer();
|
|
21944
21904
|
if (!this.enabled) return;
|
|
21905
|
+
const pointers = pointersLayer?.find(".pointer") ?? [];
|
|
21906
|
+
for (const pointer of pointers) pointer.destroy();
|
|
21945
21907
|
for (const userPointerKey of Object.keys(this.usersPointers)) {
|
|
21946
21908
|
const userPointer = this.usersPointers[userPointerKey];
|
|
21947
|
-
const userPointerNode =
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
name: "pointer",
|
|
21951
|
-
id: `pointer_${userPointer.actualPos.user}`,
|
|
21952
|
-
x: userPointer.actualPos.x,
|
|
21953
|
-
y: userPointer.actualPos.y,
|
|
21954
|
-
opacity: 1,
|
|
21955
|
-
listening: false
|
|
21956
|
-
});
|
|
21957
|
-
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21958
|
-
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21959
|
-
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21960
|
-
const userPointNode = new konva.default.Circle({
|
|
21961
|
-
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21962
|
-
x: 0,
|
|
21963
|
-
y: 0,
|
|
21964
|
-
radius: circleRadius,
|
|
21965
|
-
fill: userColor,
|
|
21966
|
-
stroke: "black",
|
|
21967
|
-
strokeWidth: circleStrokeWidth,
|
|
21968
|
-
strokeScaleEnabled: false,
|
|
21969
|
-
listening: false
|
|
21970
|
-
});
|
|
21971
|
-
const userNameNode = new konva.default.Text({
|
|
21972
|
-
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21973
|
-
x: separation,
|
|
21974
|
-
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21975
|
-
text: userPointer.actualPos.user.trim(),
|
|
21976
|
-
fontSize,
|
|
21977
|
-
fontFamily,
|
|
21978
|
-
lineHeight: .9,
|
|
21979
|
-
fill: userContrastColor,
|
|
21980
|
-
align: "center",
|
|
21981
|
-
verticalAlign: "middle",
|
|
21982
|
-
listening: false,
|
|
21983
|
-
strokeScaleEnabled: false,
|
|
21984
|
-
ellipsis: true
|
|
21985
|
-
});
|
|
21986
|
-
const textWidth = userNameNode.getTextWidth();
|
|
21987
|
-
const textHeight = userNameNode.getTextHeight();
|
|
21988
|
-
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21989
|
-
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21990
|
-
const userNameBackground = new konva.default.Rect({
|
|
21991
|
-
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21992
|
-
x: separation,
|
|
21993
|
-
y: -backgroundPaddingY,
|
|
21994
|
-
width: textWidth + backgroundPaddingX * 2,
|
|
21995
|
-
height: textHeight + backgroundPaddingY * 2,
|
|
21996
|
-
cornerRadius: backgroundCornerRadius,
|
|
21997
|
-
fill: userColor,
|
|
21998
|
-
listening: false
|
|
21999
|
-
});
|
|
22000
|
-
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
22001
|
-
userPointerNode$1.add(userPointNode);
|
|
22002
|
-
userPointerNode$1.add(userNameBackground);
|
|
22003
|
-
userPointerNode$1.add(userNameNode);
|
|
22004
|
-
pointersLayer?.add(userPointerNode$1);
|
|
22005
|
-
continue;
|
|
22006
|
-
}
|
|
22007
|
-
const oldPos = {
|
|
22008
|
-
x: userPointer.oldPos.x,
|
|
22009
|
-
y: userPointer.oldPos.y
|
|
22010
|
-
};
|
|
22011
|
-
const actualPos = {
|
|
22012
|
-
x: userPointer.actualPos.x,
|
|
22013
|
-
y: userPointer.actualPos.y
|
|
22014
|
-
};
|
|
22015
|
-
const hasChanged = !import_lodash.default.isEqual(actualPos, oldPos);
|
|
22016
|
-
userPointerNode.scaleX(1 / stage.scaleX());
|
|
22017
|
-
userPointerNode.scaleY(1 / stage.scaleY());
|
|
22018
|
-
if (hasChanged) userPointerNode.setAttrs({
|
|
21909
|
+
const userPointerNode = new konva.default.Group({
|
|
21910
|
+
name: "pointer",
|
|
21911
|
+
id: `pointer_${userPointer.actualPos.user}`,
|
|
22019
21912
|
x: userPointer.actualPos.x,
|
|
22020
21913
|
y: userPointer.actualPos.y,
|
|
22021
|
-
opacity: 1
|
|
21914
|
+
opacity: 1,
|
|
21915
|
+
listening: false,
|
|
21916
|
+
scaleX: 1 / stage.scaleX(),
|
|
21917
|
+
scaleY: 1 / stage.scaleY()
|
|
21918
|
+
});
|
|
21919
|
+
userPointerNode.moveToTop();
|
|
21920
|
+
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21921
|
+
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21922
|
+
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21923
|
+
const userPointNode = new konva.default.Circle({
|
|
21924
|
+
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21925
|
+
x: 0,
|
|
21926
|
+
y: 0,
|
|
21927
|
+
radius: circleRadius,
|
|
21928
|
+
fill: userColor,
|
|
21929
|
+
stroke: "black",
|
|
21930
|
+
strokeWidth: circleStrokeWidth,
|
|
21931
|
+
strokeScaleEnabled: false,
|
|
21932
|
+
listening: false
|
|
21933
|
+
});
|
|
21934
|
+
const userNameNode = new konva.default.Text({
|
|
21935
|
+
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21936
|
+
x: separation,
|
|
21937
|
+
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21938
|
+
text: userPointer.actualPos.user.trim(),
|
|
21939
|
+
fontSize,
|
|
21940
|
+
fontFamily,
|
|
21941
|
+
lineHeight: .9,
|
|
21942
|
+
fill: userContrastColor,
|
|
21943
|
+
align: "center",
|
|
21944
|
+
verticalAlign: "middle",
|
|
21945
|
+
listening: false,
|
|
21946
|
+
strokeScaleEnabled: false,
|
|
21947
|
+
ellipsis: true
|
|
21948
|
+
});
|
|
21949
|
+
const textWidth = userNameNode.getTextWidth();
|
|
21950
|
+
const textHeight = userNameNode.getTextHeight();
|
|
21951
|
+
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21952
|
+
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21953
|
+
const userNameBackground = new konva.default.Rect({
|
|
21954
|
+
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21955
|
+
x: separation,
|
|
21956
|
+
y: -backgroundPaddingY,
|
|
21957
|
+
width: textWidth + backgroundPaddingX * 2,
|
|
21958
|
+
height: textHeight + backgroundPaddingY * 2,
|
|
21959
|
+
cornerRadius: backgroundCornerRadius,
|
|
21960
|
+
fill: userColor,
|
|
21961
|
+
listening: false
|
|
22022
21962
|
});
|
|
21963
|
+
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21964
|
+
userPointerNode.add(userPointNode);
|
|
21965
|
+
userPointerNode.add(userNameBackground);
|
|
21966
|
+
userPointerNode.add(userNameNode);
|
|
21967
|
+
pointersLayer?.add(userPointerNode);
|
|
22023
21968
|
}
|
|
21969
|
+
const selectors = pointersLayer?.find(".selector") ?? [];
|
|
21970
|
+
for (const selector of selectors) selector.moveToBottom();
|
|
22024
21971
|
}
|
|
22025
21972
|
enable() {
|
|
22026
21973
|
this.getLayer()?.show();
|
|
@@ -22469,9 +22416,7 @@ exports.WEAVE_NODES_SELECTION_LAYER_ID = WEAVE_NODES_SELECTION_LAYER_ID
|
|
|
22469
22416
|
exports.WEAVE_NODES_SNAPPING_KEY = WEAVE_NODES_SNAPPING_KEY
|
|
22470
22417
|
exports.WEAVE_STAGE_GRID_KEY = WEAVE_STAGE_GRID_KEY
|
|
22471
22418
|
exports.WEAVE_USERS_POINTERS_KEY = WEAVE_USERS_POINTERS_KEY
|
|
22472
|
-
exports.WEAVE_USERS_POINTERS_LAYER_ID = WEAVE_USERS_POINTERS_LAYER_ID
|
|
22473
22419
|
exports.WEAVE_USERS_SELECTION_KEY = WEAVE_USERS_SELECTION_KEY
|
|
22474
|
-
exports.WEAVE_USERS_SELECTION_LAYER_ID = WEAVE_USERS_SELECTION_LAYER_ID
|
|
22475
22420
|
exports.WEAVE_USER_POINTERS_DEFAULT_PROPS = WEAVE_USER_POINTERS_DEFAULT_PROPS
|
|
22476
22421
|
exports.WEAVE_USER_POINTER_KEY = WEAVE_USER_POINTER_KEY
|
|
22477
22422
|
exports.WEAVE_USER_SELECTION_KEY = WEAVE_USER_SELECTION_KEY
|
package/dist/sdk.d.cts
CHANGED
|
@@ -1281,7 +1281,6 @@ declare class WeaveConnectedUsersPlugin extends WeavePlugin {
|
|
|
1281
1281
|
//#endregion
|
|
1282
1282
|
//#region src/plugins/users-selection/constants.d.ts
|
|
1283
1283
|
declare const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
1284
|
-
declare const WEAVE_USERS_SELECTION_LAYER_ID = "usersPointersLayer";
|
|
1285
1284
|
declare const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
1286
1285
|
|
|
1287
1286
|
//#endregion
|
|
@@ -1322,7 +1321,6 @@ declare class WeaveUsersSelectionPlugin extends WeavePlugin {
|
|
|
1322
1321
|
//#endregion
|
|
1323
1322
|
//#region src/plugins/users-pointers/constants.d.ts
|
|
1324
1323
|
declare const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
1325
|
-
declare const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
1326
1324
|
declare const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
1327
1325
|
declare const WEAVE_DEFAULT_USER_INFO_FUNCTION: () => {
|
|
1328
1326
|
name: string;
|
|
@@ -1585,4 +1583,4 @@ declare class WeaveNodesSnappingPlugin extends WeavePlugin {
|
|
|
1585
1583
|
}
|
|
1586
1584
|
|
|
1587
1585
|
//#endregion
|
|
1588
|
-
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, Guide, GuideOrientation, GuideOrientationKeys, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, ImageProps, LineGuide, LineGuideStop, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NodeSnap, NodeSnapKeys, NodeSnappingEdge, NodeSnappingEdges, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, TextSerializable, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY,
|
|
1586
|
+
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, Guide, GuideOrientation, GuideOrientationKeys, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, ImageProps, LineGuide, LineGuideStop, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NodeSnap, NodeSnapKeys, NodeSnappingEdge, NodeSnappingEdges, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, TextSerializable, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveActionPropsChangeEvent, WeaveBrushToolAction, WeaveBrushToolActionState, WeaveBrushToolActionStateKeys, WeaveConnectedUserInfoKey, WeaveConnectedUsers, WeaveConnectedUsersChangeEvent, WeaveConnectedUsersPlugin, WeaveConnectedUsersPluginConfig, WeaveConnectedUsersPluginParams, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveCopyPasteNodesPluginOnCopyEvent, WeaveCopyPasteNodesPluginOnPasteEvent, WeaveCopyPasteNodesPluginOnPasteExternalEvent, WeaveCopyPasteNodesPluginState, WeaveCopyPasteNodesPluginStateKeys, WeaveExportNodeActionParams, WeaveExportNodeToolAction, WeaveExportStageActionParams, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToScreenToolActionParams, WeaveFitToSelectionToolAction, WeaveFitToSelectionToolActionParams, WeaveFrameAttributes, WeaveFrameNode, WeaveFrameNodeParams, WeaveFrameNodeSizes, WeaveFrameNodeSizesInfo, WeaveFrameNodeSizesKeys, WeaveFrameNodeSizesOrientation, WeaveFrameNodeSizesOrientationKeys, WeaveFrameProperties, WeaveFrameToolAction, WeaveFrameToolActionState, WeaveFrameToolActionStateKeys, WeaveFrameToolActionTriggerParams, WeaveFrameToolProps, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveImageToolActionOnEndLoadImageEvent, WeaveImageToolActionOnStartLoadImageEvent, WeaveImageToolActionState, WeaveImageToolActionStateKeys, WeaveImageToolActionTriggerParams, WeaveImageToolActionTriggerReturn, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveMoveToolActionState, WeaveMoveToolActionStateKeys, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSelectionPluginConfig, WeaveNodesSelectionPluginOnNodesChangeEvent, WeaveNodesSelectionPluginOnSelectionStateEvent, WeaveNodesSelectionPluginOnStageSelectionEvent, WeaveNodesSelectionPluginParams, WeaveNodesSnappingPlugin, WeaveNodesSnappingPluginConfig, WeaveNodesSnappingPluginParams, WeavePasteModel, WeavePenToolAction, WeavePenToolActionState, WeavePenToolActionStateKeys, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRectangleToolActionState, WeaveRectangleToolActionStateKeys, WeaveSelectionToolAction, WeaveSelectionToolActionState, WeaveSelectionToolActionStateKeys, WeaveStageContextMenuPluginConfig, WeaveStageContextMenuPluginOnNodeContextMenuEvent, WeaveStageContextMenuPluginParams, WeaveStageDropAreaPlugin, WeaveStageDropPluginOnStageDropEvent, WeaveStageGridPlugin, WeaveStageGridPluginConfig, WeaveStageGridPluginParams, WeaveStageGridType, WeaveStageGridTypeKeys, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomChanged, WeaveStageZoomPlugin, WeaveStageZoomPluginConfig, WeaveStageZoomPluginOnZoomChangeEvent, WeaveStageZoomPluginParams, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveTextToolActionState, WeaveTextToolActionStateKeys, WeaveToPasteNode, WeaveUserPointer, WeaveUserPointerKey, WeaveUserPointersUIProperties, WeaveUserSelectionInfo, WeaveUserSelectionKey, WeaveUsersPointersPlugin, WeaveUsersPointersPluginConfig, WeaveUsersPointersPluginParams, WeaveUsersSelectionPlugin, WeaveUsersSelectionPluginConfig, WeaveUsersSelectionPluginParams, WeaveZoomInToolAction, WeaveZoomInToolActionParams, WeaveZoomOutToolAction, WeaveZoomOutToolActionParams, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1281,7 +1281,6 @@ declare class WeaveConnectedUsersPlugin extends WeavePlugin {
|
|
|
1281
1281
|
//#endregion
|
|
1282
1282
|
//#region src/plugins/users-selection/constants.d.ts
|
|
1283
1283
|
declare const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
1284
|
-
declare const WEAVE_USERS_SELECTION_LAYER_ID = "usersPointersLayer";
|
|
1285
1284
|
declare const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
1286
1285
|
|
|
1287
1286
|
//#endregion
|
|
@@ -1322,7 +1321,6 @@ declare class WeaveUsersSelectionPlugin extends WeavePlugin {
|
|
|
1322
1321
|
//#endregion
|
|
1323
1322
|
//#region src/plugins/users-pointers/constants.d.ts
|
|
1324
1323
|
declare const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
1325
|
-
declare const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
1326
1324
|
declare const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
1327
1325
|
declare const WEAVE_DEFAULT_USER_INFO_FUNCTION: () => {
|
|
1328
1326
|
name: string;
|
|
@@ -1585,4 +1583,4 @@ declare class WeaveNodesSnappingPlugin extends WeavePlugin {
|
|
|
1585
1583
|
}
|
|
1586
1584
|
|
|
1587
1585
|
//#endregion
|
|
1588
|
-
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, Guide, GuideOrientation, GuideOrientationKeys, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, ImageProps, LineGuide, LineGuideStop, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NodeSnap, NodeSnapKeys, NodeSnappingEdge, NodeSnappingEdges, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, TextSerializable, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY,
|
|
1586
|
+
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, Guide, GuideOrientation, GuideOrientationKeys, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, ImageProps, LineGuide, LineGuideStop, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NodeSnap, NodeSnapKeys, NodeSnappingEdge, NodeSnappingEdges, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, TextSerializable, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveActionPropsChangeEvent, WeaveBrushToolAction, WeaveBrushToolActionState, WeaveBrushToolActionStateKeys, WeaveConnectedUserInfoKey, WeaveConnectedUsers, WeaveConnectedUsersChangeEvent, WeaveConnectedUsersPlugin, WeaveConnectedUsersPluginConfig, WeaveConnectedUsersPluginParams, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveCopyPasteNodesPluginOnCopyEvent, WeaveCopyPasteNodesPluginOnPasteEvent, WeaveCopyPasteNodesPluginOnPasteExternalEvent, WeaveCopyPasteNodesPluginState, WeaveCopyPasteNodesPluginStateKeys, WeaveExportNodeActionParams, WeaveExportNodeToolAction, WeaveExportStageActionParams, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToScreenToolActionParams, WeaveFitToSelectionToolAction, WeaveFitToSelectionToolActionParams, WeaveFrameAttributes, WeaveFrameNode, WeaveFrameNodeParams, WeaveFrameNodeSizes, WeaveFrameNodeSizesInfo, WeaveFrameNodeSizesKeys, WeaveFrameNodeSizesOrientation, WeaveFrameNodeSizesOrientationKeys, WeaveFrameProperties, WeaveFrameToolAction, WeaveFrameToolActionState, WeaveFrameToolActionStateKeys, WeaveFrameToolActionTriggerParams, WeaveFrameToolProps, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveImageToolActionOnEndLoadImageEvent, WeaveImageToolActionOnStartLoadImageEvent, WeaveImageToolActionState, WeaveImageToolActionStateKeys, WeaveImageToolActionTriggerParams, WeaveImageToolActionTriggerReturn, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveMoveToolActionState, WeaveMoveToolActionStateKeys, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSelectionPluginConfig, WeaveNodesSelectionPluginOnNodesChangeEvent, WeaveNodesSelectionPluginOnSelectionStateEvent, WeaveNodesSelectionPluginOnStageSelectionEvent, WeaveNodesSelectionPluginParams, WeaveNodesSnappingPlugin, WeaveNodesSnappingPluginConfig, WeaveNodesSnappingPluginParams, WeavePasteModel, WeavePenToolAction, WeavePenToolActionState, WeavePenToolActionStateKeys, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRectangleToolActionState, WeaveRectangleToolActionStateKeys, WeaveSelectionToolAction, WeaveSelectionToolActionState, WeaveSelectionToolActionStateKeys, WeaveStageContextMenuPluginConfig, WeaveStageContextMenuPluginOnNodeContextMenuEvent, WeaveStageContextMenuPluginParams, WeaveStageDropAreaPlugin, WeaveStageDropPluginOnStageDropEvent, WeaveStageGridPlugin, WeaveStageGridPluginConfig, WeaveStageGridPluginParams, WeaveStageGridType, WeaveStageGridTypeKeys, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomChanged, WeaveStageZoomPlugin, WeaveStageZoomPluginConfig, WeaveStageZoomPluginOnZoomChangeEvent, WeaveStageZoomPluginParams, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveTextToolActionState, WeaveTextToolActionStateKeys, WeaveToPasteNode, WeaveUserPointer, WeaveUserPointerKey, WeaveUserPointersUIProperties, WeaveUserSelectionInfo, WeaveUserSelectionKey, WeaveUsersPointersPlugin, WeaveUsersPointersPluginConfig, WeaveUsersPointersPluginParams, WeaveUsersSelectionPlugin, WeaveUsersSelectionPluginConfig, WeaveUsersSelectionPluginParams, WeaveZoomInToolAction, WeaveZoomInToolActionParams, WeaveZoomOutToolAction, WeaveZoomOutToolActionParams, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
package/dist/sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Konva from "konva";
|
|
2
2
|
import "konva/lib/types";
|
|
3
|
-
import { WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
|
|
3
|
+
import { WEAVE_AWARENESS_LAYER_ID, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
|
|
4
4
|
import { getYjsDoc, getYjsValue, observeDeep, syncedStore } from "@syncedstore/core";
|
|
5
5
|
import { Doc, UndoManager } from "yjs";
|
|
6
6
|
import React from "react";
|
|
@@ -15794,7 +15794,6 @@ function moveNodeToContainer(instance, node) {
|
|
|
15794
15794
|
//#endregion
|
|
15795
15795
|
//#region src/plugins/users-selection/constants.ts
|
|
15796
15796
|
const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
15797
|
-
const WEAVE_USERS_SELECTION_LAYER_ID = "usersPointersLayer";
|
|
15798
15797
|
const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
15799
15798
|
|
|
15800
15799
|
//#endregion
|
|
@@ -17920,7 +17919,7 @@ var WeaveRegisterManager = class {
|
|
|
17920
17919
|
|
|
17921
17920
|
//#endregion
|
|
17922
17921
|
//#region package.json
|
|
17923
|
-
var version = "0.16.
|
|
17922
|
+
var version = "0.16.2";
|
|
17924
17923
|
|
|
17925
17924
|
//#endregion
|
|
17926
17925
|
//#region src/managers/setup.ts
|
|
@@ -18947,9 +18946,11 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
18947
18946
|
tr.hide();
|
|
18948
18947
|
}
|
|
18949
18948
|
const textPosition = textNode.absolutePosition();
|
|
18949
|
+
const stageContainer = stage.container();
|
|
18950
|
+
const stageRect = stageContainer.getBoundingClientRect();
|
|
18950
18951
|
const areaPosition = {
|
|
18951
|
-
x:
|
|
18952
|
-
y:
|
|
18952
|
+
x: stageRect.x + stageContainer.offsetLeft + textPosition.x,
|
|
18953
|
+
y: stageRect.y + stageContainer.offsetTop + textPosition.y
|
|
18953
18954
|
};
|
|
18954
18955
|
this.createTextAreaDOM(textNode, areaPosition);
|
|
18955
18956
|
}
|
|
@@ -21636,7 +21637,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21636
21637
|
return WEAVE_USERS_SELECTION_KEY;
|
|
21637
21638
|
}
|
|
21638
21639
|
getLayerName() {
|
|
21639
|
-
return
|
|
21640
|
+
return WEAVE_AWARENESS_LAYER_ID;
|
|
21640
21641
|
}
|
|
21641
21642
|
initLayer() {
|
|
21642
21643
|
const stage = this.instance.getStage();
|
|
@@ -21651,7 +21652,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21651
21652
|
}
|
|
21652
21653
|
getLayer() {
|
|
21653
21654
|
const stage = this.instance.getStage();
|
|
21654
|
-
return stage.findOne(`#${
|
|
21655
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21655
21656
|
}
|
|
21656
21657
|
onInit() {
|
|
21657
21658
|
this.instance.addEventListener("onAwarenessChange", (changes) => {
|
|
@@ -21671,17 +21672,6 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21671
21672
|
};
|
|
21672
21673
|
}
|
|
21673
21674
|
}
|
|
21674
|
-
const allActiveUsersSelections = Object.keys(this.usersSelection).map((userSelectionKey) => {
|
|
21675
|
-
const selectionInfo = this.usersSelection[userSelectionKey];
|
|
21676
|
-
return selectionInfo.actualNodes.user;
|
|
21677
|
-
});
|
|
21678
|
-
const inactiveSelections = import_lodash.default.differenceWith(allActiveUsersSelections, allActiveUsers, import_lodash.default.isEqual);
|
|
21679
|
-
const selectionsLayer = this.getLayer();
|
|
21680
|
-
for (const inactiveSelection of inactiveSelections) {
|
|
21681
|
-
const userPointerNode = selectionsLayer?.findOne(`#${inactiveSelection}`);
|
|
21682
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21683
|
-
delete this.usersSelection[inactiveSelection];
|
|
21684
|
-
}
|
|
21685
21675
|
this.renderSelectors();
|
|
21686
21676
|
});
|
|
21687
21677
|
this.renderSelectors();
|
|
@@ -21748,51 +21738,33 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21748
21738
|
for (const selector of selectors) selector.destroy();
|
|
21749
21739
|
for (const userPointerKey of Object.keys(this.usersSelection)) {
|
|
21750
21740
|
const userSelector = this.usersSelection[userPointerKey];
|
|
21751
|
-
const
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
selectorsLayer?.add(userSelectorNode$1);
|
|
21776
|
-
continue;
|
|
21777
|
-
}
|
|
21778
|
-
const userSelectorRect = selectorsLayer?.findOne(`#selector_${userSelector.actualNodes.user}_rect`);
|
|
21779
|
-
if (userSelectorRect) {
|
|
21780
|
-
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21781
|
-
userSelectorNode.setAttrs({
|
|
21782
|
-
x: selectionRect.x,
|
|
21783
|
-
y: selectionRect.y,
|
|
21784
|
-
width: selectionRect.width,
|
|
21785
|
-
height: selectionRect.height,
|
|
21786
|
-
scale: 1
|
|
21787
|
-
});
|
|
21788
|
-
userSelectorRect.setAttrs({
|
|
21789
|
-
x: 0,
|
|
21790
|
-
y: 0,
|
|
21791
|
-
width: selectionRect.width,
|
|
21792
|
-
height: selectionRect.height
|
|
21793
|
-
});
|
|
21794
|
-
}
|
|
21741
|
+
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21742
|
+
const userSelectorNode = new Konva.Group({
|
|
21743
|
+
name: "selector",
|
|
21744
|
+
id: `selector_${userSelector.actualNodes.user}`,
|
|
21745
|
+
x: selectionRect.x,
|
|
21746
|
+
y: selectionRect.y,
|
|
21747
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21748
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21749
|
+
listening: false
|
|
21750
|
+
});
|
|
21751
|
+
userSelectorNode.moveToBottom();
|
|
21752
|
+
const userSelectorRect = new Konva.Rect({
|
|
21753
|
+
x: 0,
|
|
21754
|
+
y: 0,
|
|
21755
|
+
id: `selector_${userSelector.actualNodes.user}_rect`,
|
|
21756
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21757
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21758
|
+
fill: "transparent",
|
|
21759
|
+
stroke: this.stringToColor(userSelector.actualNodes.user),
|
|
21760
|
+
strokeWidth: 3,
|
|
21761
|
+
strokeScaleEnabled: false
|
|
21762
|
+
});
|
|
21763
|
+
userSelectorNode.add(userSelectorRect);
|
|
21764
|
+
selectorsLayer?.add(userSelectorNode);
|
|
21795
21765
|
}
|
|
21766
|
+
const pointers = selectorsLayer?.find(".pointer") ?? [];
|
|
21767
|
+
for (const pointer of pointers) pointer.moveToTop();
|
|
21796
21768
|
}
|
|
21797
21769
|
enable() {
|
|
21798
21770
|
this.getLayer()?.show();
|
|
@@ -21807,7 +21779,6 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
21807
21779
|
//#endregion
|
|
21808
21780
|
//#region src/plugins/users-pointers/constants.ts
|
|
21809
21781
|
const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
21810
|
-
const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
21811
21782
|
const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
21812
21783
|
const WEAVE_DEFAULT_USER_INFO_FUNCTION = () => ({
|
|
21813
21784
|
name: "Unknown",
|
|
@@ -21845,7 +21816,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21845
21816
|
return WEAVE_USERS_POINTERS_KEY;
|
|
21846
21817
|
}
|
|
21847
21818
|
getLayerName() {
|
|
21848
|
-
return
|
|
21819
|
+
return WEAVE_AWARENESS_LAYER_ID;
|
|
21849
21820
|
}
|
|
21850
21821
|
initLayer() {
|
|
21851
21822
|
const stage = this.instance.getStage();
|
|
@@ -21860,7 +21831,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21860
21831
|
}
|
|
21861
21832
|
getLayer() {
|
|
21862
21833
|
const stage = this.instance.getStage();
|
|
21863
|
-
return stage.findOne(`#${
|
|
21834
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21864
21835
|
}
|
|
21865
21836
|
onInit() {
|
|
21866
21837
|
const store = this.instance.getStore();
|
|
@@ -21883,17 +21854,6 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21883
21854
|
};
|
|
21884
21855
|
}
|
|
21885
21856
|
}
|
|
21886
|
-
const allActiveUsersPointers = Object.keys(this.usersPointers).map((userPointerKey) => {
|
|
21887
|
-
const pointerInfo = this.usersPointers[userPointerKey];
|
|
21888
|
-
return pointerInfo.actualPos.user;
|
|
21889
|
-
});
|
|
21890
|
-
const inactivePointers = import_lodash.default.differenceWith(allActiveUsersPointers, allActiveUsers, import_lodash.default.isEqual);
|
|
21891
|
-
const pointersLayer = this.getLayer();
|
|
21892
|
-
for (const inactivePointer of inactivePointers) {
|
|
21893
|
-
const userPointerNode = pointersLayer?.findOne(`#pointer_${inactivePointer}`);
|
|
21894
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21895
|
-
delete this.usersPointers[inactivePointer];
|
|
21896
|
-
}
|
|
21897
21857
|
this.renderPointers();
|
|
21898
21858
|
});
|
|
21899
21859
|
stage.on("dragmove", (e) => {
|
|
@@ -21942,85 +21902,72 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21942
21902
|
const stage = this.instance.getStage();
|
|
21943
21903
|
const pointersLayer = this.getLayer();
|
|
21944
21904
|
if (!this.enabled) return;
|
|
21905
|
+
const pointers = pointersLayer?.find(".pointer") ?? [];
|
|
21906
|
+
for (const pointer of pointers) pointer.destroy();
|
|
21945
21907
|
for (const userPointerKey of Object.keys(this.usersPointers)) {
|
|
21946
21908
|
const userPointer = this.usersPointers[userPointerKey];
|
|
21947
|
-
const userPointerNode =
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
name: "pointer",
|
|
21951
|
-
id: `pointer_${userPointer.actualPos.user}`,
|
|
21952
|
-
x: userPointer.actualPos.x,
|
|
21953
|
-
y: userPointer.actualPos.y,
|
|
21954
|
-
opacity: 1,
|
|
21955
|
-
listening: false
|
|
21956
|
-
});
|
|
21957
|
-
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21958
|
-
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21959
|
-
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21960
|
-
const userPointNode = new Konva.Circle({
|
|
21961
|
-
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21962
|
-
x: 0,
|
|
21963
|
-
y: 0,
|
|
21964
|
-
radius: circleRadius,
|
|
21965
|
-
fill: userColor,
|
|
21966
|
-
stroke: "black",
|
|
21967
|
-
strokeWidth: circleStrokeWidth,
|
|
21968
|
-
strokeScaleEnabled: false,
|
|
21969
|
-
listening: false
|
|
21970
|
-
});
|
|
21971
|
-
const userNameNode = new Konva.Text({
|
|
21972
|
-
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21973
|
-
x: separation,
|
|
21974
|
-
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21975
|
-
text: userPointer.actualPos.user.trim(),
|
|
21976
|
-
fontSize,
|
|
21977
|
-
fontFamily,
|
|
21978
|
-
lineHeight: .9,
|
|
21979
|
-
fill: userContrastColor,
|
|
21980
|
-
align: "center",
|
|
21981
|
-
verticalAlign: "middle",
|
|
21982
|
-
listening: false,
|
|
21983
|
-
strokeScaleEnabled: false,
|
|
21984
|
-
ellipsis: true
|
|
21985
|
-
});
|
|
21986
|
-
const textWidth = userNameNode.getTextWidth();
|
|
21987
|
-
const textHeight = userNameNode.getTextHeight();
|
|
21988
|
-
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21989
|
-
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21990
|
-
const userNameBackground = new Konva.Rect({
|
|
21991
|
-
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21992
|
-
x: separation,
|
|
21993
|
-
y: -backgroundPaddingY,
|
|
21994
|
-
width: textWidth + backgroundPaddingX * 2,
|
|
21995
|
-
height: textHeight + backgroundPaddingY * 2,
|
|
21996
|
-
cornerRadius: backgroundCornerRadius,
|
|
21997
|
-
fill: userColor,
|
|
21998
|
-
listening: false
|
|
21999
|
-
});
|
|
22000
|
-
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
22001
|
-
userPointerNode$1.add(userPointNode);
|
|
22002
|
-
userPointerNode$1.add(userNameBackground);
|
|
22003
|
-
userPointerNode$1.add(userNameNode);
|
|
22004
|
-
pointersLayer?.add(userPointerNode$1);
|
|
22005
|
-
continue;
|
|
22006
|
-
}
|
|
22007
|
-
const oldPos = {
|
|
22008
|
-
x: userPointer.oldPos.x,
|
|
22009
|
-
y: userPointer.oldPos.y
|
|
22010
|
-
};
|
|
22011
|
-
const actualPos = {
|
|
22012
|
-
x: userPointer.actualPos.x,
|
|
22013
|
-
y: userPointer.actualPos.y
|
|
22014
|
-
};
|
|
22015
|
-
const hasChanged = !import_lodash.default.isEqual(actualPos, oldPos);
|
|
22016
|
-
userPointerNode.scaleX(1 / stage.scaleX());
|
|
22017
|
-
userPointerNode.scaleY(1 / stage.scaleY());
|
|
22018
|
-
if (hasChanged) userPointerNode.setAttrs({
|
|
21909
|
+
const userPointerNode = new Konva.Group({
|
|
21910
|
+
name: "pointer",
|
|
21911
|
+
id: `pointer_${userPointer.actualPos.user}`,
|
|
22019
21912
|
x: userPointer.actualPos.x,
|
|
22020
21913
|
y: userPointer.actualPos.y,
|
|
22021
|
-
opacity: 1
|
|
21914
|
+
opacity: 1,
|
|
21915
|
+
listening: false,
|
|
21916
|
+
scaleX: 1 / stage.scaleX(),
|
|
21917
|
+
scaleY: 1 / stage.scaleY()
|
|
21918
|
+
});
|
|
21919
|
+
userPointerNode.moveToTop();
|
|
21920
|
+
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21921
|
+
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21922
|
+
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21923
|
+
const userPointNode = new Konva.Circle({
|
|
21924
|
+
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21925
|
+
x: 0,
|
|
21926
|
+
y: 0,
|
|
21927
|
+
radius: circleRadius,
|
|
21928
|
+
fill: userColor,
|
|
21929
|
+
stroke: "black",
|
|
21930
|
+
strokeWidth: circleStrokeWidth,
|
|
21931
|
+
strokeScaleEnabled: false,
|
|
21932
|
+
listening: false
|
|
21933
|
+
});
|
|
21934
|
+
const userNameNode = new Konva.Text({
|
|
21935
|
+
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21936
|
+
x: separation,
|
|
21937
|
+
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21938
|
+
text: userPointer.actualPos.user.trim(),
|
|
21939
|
+
fontSize,
|
|
21940
|
+
fontFamily,
|
|
21941
|
+
lineHeight: .9,
|
|
21942
|
+
fill: userContrastColor,
|
|
21943
|
+
align: "center",
|
|
21944
|
+
verticalAlign: "middle",
|
|
21945
|
+
listening: false,
|
|
21946
|
+
strokeScaleEnabled: false,
|
|
21947
|
+
ellipsis: true
|
|
21948
|
+
});
|
|
21949
|
+
const textWidth = userNameNode.getTextWidth();
|
|
21950
|
+
const textHeight = userNameNode.getTextHeight();
|
|
21951
|
+
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21952
|
+
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21953
|
+
const userNameBackground = new Konva.Rect({
|
|
21954
|
+
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21955
|
+
x: separation,
|
|
21956
|
+
y: -backgroundPaddingY,
|
|
21957
|
+
width: textWidth + backgroundPaddingX * 2,
|
|
21958
|
+
height: textHeight + backgroundPaddingY * 2,
|
|
21959
|
+
cornerRadius: backgroundCornerRadius,
|
|
21960
|
+
fill: userColor,
|
|
21961
|
+
listening: false
|
|
22022
21962
|
});
|
|
21963
|
+
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21964
|
+
userPointerNode.add(userPointNode);
|
|
21965
|
+
userPointerNode.add(userNameBackground);
|
|
21966
|
+
userPointerNode.add(userNameNode);
|
|
21967
|
+
pointersLayer?.add(userPointerNode);
|
|
22023
21968
|
}
|
|
21969
|
+
const selectors = pointersLayer?.find(".selector") ?? [];
|
|
21970
|
+
for (const selector of selectors) selector.moveToBottom();
|
|
22024
21971
|
}
|
|
22025
21972
|
enable() {
|
|
22026
21973
|
this.getLayer()?.show();
|
|
@@ -22426,4 +22373,4 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
|
|
|
22426
22373
|
};
|
|
22427
22374
|
|
|
22428
22375
|
//#endregion
|
|
22429
|
-
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY,
|
|
22376
|
+
export { BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_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, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, 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_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_STAGE_GRID_KEY, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, 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, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/weave-sdk",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@inditextech/weave-types": "0.16.
|
|
46
|
+
"@inditextech/weave-types": "0.16.2",
|
|
47
47
|
"@syncedstore/core": "0.6.0",
|
|
48
48
|
"canvas": "3.1.0",
|
|
49
49
|
"konva": "9.3.20",
|