@inditextech/weave-sdk 0.15.0 → 0.16.1
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 +269 -115
- package/dist/sdk.d.cts +79 -10
- package/dist/sdk.d.ts +79 -10
- package/dist/sdk.js +264 -117
- package/package.json +2 -2
package/dist/sdk.cjs
CHANGED
|
@@ -15761,7 +15761,7 @@ function clearContainerTargets(instance) {
|
|
|
15761
15761
|
for (const container of getContainers) container.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
|
|
15762
15762
|
}
|
|
15763
15763
|
function checkIfOverContainer(instance, node) {
|
|
15764
|
-
const nodesIntersected = instance.pointIntersectsContainerElement();
|
|
15764
|
+
const nodesIntersected = instance.pointIntersectsContainerElement(node.getParent());
|
|
15765
15765
|
let nodeActualContainer = node.getParent();
|
|
15766
15766
|
if (nodeActualContainer?.getAttrs().nodeId) nodeActualContainer = instance.getStage().findOne(`#${nodeActualContainer.getAttrs().nodeId}`);
|
|
15767
15767
|
let layerToMove = void 0;
|
|
@@ -15791,6 +15791,11 @@ function moveNodeToContainer(instance, node) {
|
|
|
15791
15791
|
return layerToMove;
|
|
15792
15792
|
}
|
|
15793
15793
|
|
|
15794
|
+
//#endregion
|
|
15795
|
+
//#region src/plugins/users-selection/constants.ts
|
|
15796
|
+
const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
15797
|
+
const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
15798
|
+
|
|
15794
15799
|
//#endregion
|
|
15795
15800
|
//#region src/plugins/nodes-selection/nodes-selection.ts
|
|
15796
15801
|
var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
@@ -15955,6 +15960,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15955
15960
|
node: nodeHandler.serialize(node)
|
|
15956
15961
|
};
|
|
15957
15962
|
});
|
|
15963
|
+
const usersSelectionPlugin = this.instance.getPlugin(WEAVE_USERS_SELECTION_KEY);
|
|
15964
|
+
if (usersSelectionPlugin) usersSelectionPlugin.sendSelectionAwarenessInfo(this.tr);
|
|
15958
15965
|
this.instance.emitEvent("onNodesChange", selectedNodes);
|
|
15959
15966
|
}
|
|
15960
15967
|
removeSelectedNodes() {
|
|
@@ -17131,7 +17138,7 @@ var WeaveTargetingManager = class {
|
|
|
17131
17138
|
this.logger = this.instance.getChildLogger("targeting-manager");
|
|
17132
17139
|
this.logger.debug("Targeting manager created");
|
|
17133
17140
|
}
|
|
17134
|
-
pointIntersectsContainerElement(point) {
|
|
17141
|
+
pointIntersectsContainerElement(actualLayer, point) {
|
|
17135
17142
|
const stage = this.instance.getStage();
|
|
17136
17143
|
const relativeMousePointer = point ? point : stage.getPointerPosition() ?? {
|
|
17137
17144
|
x: 0,
|
|
@@ -17143,11 +17150,11 @@ var WeaveTargetingManager = class {
|
|
|
17143
17150
|
if (node.getAttrs().nodeId) {
|
|
17144
17151
|
const parent = stage.findOne(`#${node.getAttrs().nodeId}`);
|
|
17145
17152
|
intersectedNode = parent;
|
|
17146
|
-
|
|
17153
|
+
continue;
|
|
17147
17154
|
}
|
|
17148
|
-
if (node.getAttrs().containerId) {
|
|
17155
|
+
if (node.getAttrs().containerId && node.getAttrs().id !== actualLayer?.getAttrs().id) {
|
|
17149
17156
|
intersectedNode = node;
|
|
17150
|
-
|
|
17157
|
+
continue;
|
|
17151
17158
|
}
|
|
17152
17159
|
}
|
|
17153
17160
|
return intersectedNode;
|
|
@@ -17912,7 +17919,7 @@ var WeaveRegisterManager = class {
|
|
|
17912
17919
|
|
|
17913
17920
|
//#endregion
|
|
17914
17921
|
//#region package.json
|
|
17915
|
-
var version = "0.
|
|
17922
|
+
var version = "0.16.1";
|
|
17916
17923
|
|
|
17917
17924
|
//#endregion
|
|
17918
17925
|
//#region src/managers/setup.ts
|
|
@@ -18518,8 +18525,8 @@ var Weave = class extends Emittery {
|
|
|
18518
18525
|
unGroup(group) {
|
|
18519
18526
|
this.groupsManager.unGroup(group);
|
|
18520
18527
|
}
|
|
18521
|
-
pointIntersectsContainerElement(point) {
|
|
18522
|
-
return this.targetingManager.pointIntersectsContainerElement(point);
|
|
18528
|
+
pointIntersectsContainerElement(actualLayer, point) {
|
|
18529
|
+
return this.targetingManager.pointIntersectsContainerElement(actualLayer, point);
|
|
18523
18530
|
}
|
|
18524
18531
|
getMousePointer(point) {
|
|
18525
18532
|
return this.targetingManager.getMousePointer(point);
|
|
@@ -21615,33 +21622,199 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
21615
21622
|
}
|
|
21616
21623
|
};
|
|
21617
21624
|
|
|
21625
|
+
//#endregion
|
|
21626
|
+
//#region src/plugins/users-selection/users-selection.ts
|
|
21627
|
+
var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
21628
|
+
constructor(params) {
|
|
21629
|
+
super();
|
|
21630
|
+
const { config } = params;
|
|
21631
|
+
this.config = config;
|
|
21632
|
+
this.usersSelection = {};
|
|
21633
|
+
}
|
|
21634
|
+
getName() {
|
|
21635
|
+
return WEAVE_USERS_SELECTION_KEY;
|
|
21636
|
+
}
|
|
21637
|
+
getLayerName() {
|
|
21638
|
+
return __inditextech_weave_types.WEAVE_AWARENESS_LAYER_ID;
|
|
21639
|
+
}
|
|
21640
|
+
initLayer() {
|
|
21641
|
+
const stage = this.instance.getStage();
|
|
21642
|
+
const layer = new konva.default.Layer({
|
|
21643
|
+
id: this.getLayerName(),
|
|
21644
|
+
listening: false
|
|
21645
|
+
});
|
|
21646
|
+
stage.add(layer);
|
|
21647
|
+
}
|
|
21648
|
+
onRender() {
|
|
21649
|
+
this.renderSelectors();
|
|
21650
|
+
}
|
|
21651
|
+
getLayer() {
|
|
21652
|
+
const stage = this.instance.getStage();
|
|
21653
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21654
|
+
}
|
|
21655
|
+
onInit() {
|
|
21656
|
+
this.instance.addEventListener("onAwarenessChange", (changes) => {
|
|
21657
|
+
const selfUser = this.config.getUser();
|
|
21658
|
+
const allActiveUsers = [];
|
|
21659
|
+
for (const change of changes) {
|
|
21660
|
+
if (!change[WEAVE_USER_SELECTION_KEY]) continue;
|
|
21661
|
+
if (change[WEAVE_USER_SELECTION_KEY] && selfUser.name !== change[WEAVE_USER_SELECTION_KEY].user) {
|
|
21662
|
+
const userSelection = change[WEAVE_USER_SELECTION_KEY];
|
|
21663
|
+
allActiveUsers.push(userSelection.user);
|
|
21664
|
+
this.usersSelection[userSelection.user] = {
|
|
21665
|
+
oldNodes: this.usersSelection[userSelection.user]?.actualNodes ?? {
|
|
21666
|
+
user: userSelection.user,
|
|
21667
|
+
nodes: []
|
|
21668
|
+
},
|
|
21669
|
+
actualNodes: userSelection
|
|
21670
|
+
};
|
|
21671
|
+
}
|
|
21672
|
+
}
|
|
21673
|
+
this.renderSelectors();
|
|
21674
|
+
});
|
|
21675
|
+
this.renderSelectors();
|
|
21676
|
+
}
|
|
21677
|
+
sendSelectionAwarenessInfo(tr) {
|
|
21678
|
+
const userInfo = this.config.getUser();
|
|
21679
|
+
const store = this.instance.getStore();
|
|
21680
|
+
store.setAwarenessInfo(WEAVE_USER_SELECTION_KEY, {
|
|
21681
|
+
user: userInfo.name,
|
|
21682
|
+
nodes: tr.nodes().map((node) => node.getAttrs().id)
|
|
21683
|
+
});
|
|
21684
|
+
}
|
|
21685
|
+
removeSelectionAwarenessInfo() {
|
|
21686
|
+
const store = this.instance.getStore();
|
|
21687
|
+
store.setAwarenessInfo(WEAVE_USER_SELECTION_KEY, void 0);
|
|
21688
|
+
}
|
|
21689
|
+
stringToColor(str) {
|
|
21690
|
+
let hash = 0;
|
|
21691
|
+
str.split("").forEach((char) => {
|
|
21692
|
+
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
21693
|
+
});
|
|
21694
|
+
let color = "#";
|
|
21695
|
+
for (let i = 0; i < 3; i++) {
|
|
21696
|
+
const value = hash >> i * 8 & 255;
|
|
21697
|
+
color += value.toString(16).padStart(2, "0");
|
|
21698
|
+
}
|
|
21699
|
+
return color;
|
|
21700
|
+
}
|
|
21701
|
+
getSelectedNodesRect(nodes) {
|
|
21702
|
+
const stage = this.instance.getStage();
|
|
21703
|
+
const maxPoint = {
|
|
21704
|
+
x: -Infinity,
|
|
21705
|
+
y: -Infinity
|
|
21706
|
+
};
|
|
21707
|
+
const minPoint = {
|
|
21708
|
+
x: Infinity,
|
|
21709
|
+
y: Infinity
|
|
21710
|
+
};
|
|
21711
|
+
for (const nodeId of nodes) {
|
|
21712
|
+
const node = stage.findOne(`#${nodeId}`);
|
|
21713
|
+
if (node) {
|
|
21714
|
+
const nodeRect = node.getClientRect({
|
|
21715
|
+
relativeTo: stage,
|
|
21716
|
+
skipStroke: true
|
|
21717
|
+
});
|
|
21718
|
+
if (nodeRect.x < minPoint.x) minPoint.x = nodeRect.x;
|
|
21719
|
+
if (nodeRect.y < minPoint.y) minPoint.y = nodeRect.y;
|
|
21720
|
+
if (nodeRect.x + nodeRect.width > maxPoint.x) maxPoint.x = nodeRect.x + nodeRect.width;
|
|
21721
|
+
if (nodeRect.y + nodeRect.height > maxPoint.y) maxPoint.y = nodeRect.y + nodeRect.height;
|
|
21722
|
+
}
|
|
21723
|
+
}
|
|
21724
|
+
return {
|
|
21725
|
+
x: minPoint.x,
|
|
21726
|
+
y: minPoint.y,
|
|
21727
|
+
width: Math.abs(maxPoint.x - minPoint.x) * stage.scaleX(),
|
|
21728
|
+
height: Math.abs(maxPoint.y - minPoint.y) * stage.scaleY()
|
|
21729
|
+
};
|
|
21730
|
+
}
|
|
21731
|
+
renderSelectors() {
|
|
21732
|
+
const stage = this.instance.getStage();
|
|
21733
|
+
const selectorsLayer = this.getLayer();
|
|
21734
|
+
if (!this.enabled) return;
|
|
21735
|
+
const selectors = selectorsLayer?.find(".selector") ?? [];
|
|
21736
|
+
for (const selector of selectors) selector.destroy();
|
|
21737
|
+
for (const userPointerKey of Object.keys(this.usersSelection)) {
|
|
21738
|
+
const userSelector = this.usersSelection[userPointerKey];
|
|
21739
|
+
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21740
|
+
const userSelectorNode = new konva.default.Group({
|
|
21741
|
+
name: "selector",
|
|
21742
|
+
id: `selector_${userSelector.actualNodes.user}`,
|
|
21743
|
+
x: selectionRect.x,
|
|
21744
|
+
y: selectionRect.y,
|
|
21745
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21746
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21747
|
+
listening: false
|
|
21748
|
+
});
|
|
21749
|
+
userSelectorNode.moveToBottom();
|
|
21750
|
+
const userSelectorRect = new konva.default.Rect({
|
|
21751
|
+
x: 0,
|
|
21752
|
+
y: 0,
|
|
21753
|
+
id: `selector_${userSelector.actualNodes.user}_rect`,
|
|
21754
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21755
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21756
|
+
fill: "transparent",
|
|
21757
|
+
stroke: this.stringToColor(userSelector.actualNodes.user),
|
|
21758
|
+
strokeWidth: 3,
|
|
21759
|
+
strokeScaleEnabled: false
|
|
21760
|
+
});
|
|
21761
|
+
userSelectorNode.add(userSelectorRect);
|
|
21762
|
+
selectorsLayer?.add(userSelectorNode);
|
|
21763
|
+
}
|
|
21764
|
+
const pointers = selectorsLayer?.find(".pointer") ?? [];
|
|
21765
|
+
for (const pointer of pointers) pointer.moveToTop();
|
|
21766
|
+
}
|
|
21767
|
+
enable() {
|
|
21768
|
+
this.getLayer()?.show();
|
|
21769
|
+
this.enabled = true;
|
|
21770
|
+
}
|
|
21771
|
+
disable() {
|
|
21772
|
+
this.getLayer()?.hide();
|
|
21773
|
+
this.enabled = false;
|
|
21774
|
+
}
|
|
21775
|
+
};
|
|
21776
|
+
|
|
21618
21777
|
//#endregion
|
|
21619
21778
|
//#region src/plugins/users-pointers/constants.ts
|
|
21620
21779
|
const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
21621
|
-
const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
21622
21780
|
const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
21781
|
+
const WEAVE_DEFAULT_USER_INFO_FUNCTION = () => ({
|
|
21782
|
+
name: "Unknown",
|
|
21783
|
+
email: "unknown@domain.com"
|
|
21784
|
+
});
|
|
21785
|
+
const WEAVE_USER_POINTERS_DEFAULT_PROPS = {
|
|
21786
|
+
separation: 8,
|
|
21787
|
+
pointer: {
|
|
21788
|
+
circleRadius: 4,
|
|
21789
|
+
circleStrokeWidth: 0
|
|
21790
|
+
},
|
|
21791
|
+
name: {
|
|
21792
|
+
fontFamily: "Arial",
|
|
21793
|
+
fontSize: 10,
|
|
21794
|
+
backgroundCornerRadius: 0,
|
|
21795
|
+
backgroundPaddingX: 8,
|
|
21796
|
+
backgroundPaddingY: 4
|
|
21797
|
+
}
|
|
21798
|
+
};
|
|
21623
21799
|
|
|
21624
21800
|
//#endregion
|
|
21625
21801
|
//#region src/plugins/users-pointers/users-pointers.ts
|
|
21626
21802
|
var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
21627
|
-
userPointerCircleRadius = 4;
|
|
21628
|
-
userPointerSeparation = 8;
|
|
21629
|
-
userPointerCircleStrokeWidth = 1;
|
|
21630
|
-
userPointerNameFontSize = 10;
|
|
21631
|
-
userPointerBackgroundCornerRadius = 4;
|
|
21632
|
-
userPointerBackgroundPaddingX = 4;
|
|
21633
|
-
userPointerBackgroundPaddingY = 8;
|
|
21634
21803
|
constructor(params) {
|
|
21635
21804
|
super();
|
|
21636
21805
|
const { config } = params;
|
|
21637
|
-
this.usersPointers = {};
|
|
21638
21806
|
this.config = config;
|
|
21807
|
+
this.uiConfig = {
|
|
21808
|
+
...WEAVE_USER_POINTERS_DEFAULT_PROPS,
|
|
21809
|
+
...this.config.ui
|
|
21810
|
+
};
|
|
21811
|
+
this.usersPointers = {};
|
|
21639
21812
|
}
|
|
21640
21813
|
getName() {
|
|
21641
21814
|
return WEAVE_USERS_POINTERS_KEY;
|
|
21642
21815
|
}
|
|
21643
21816
|
getLayerName() {
|
|
21644
|
-
return
|
|
21817
|
+
return __inditextech_weave_types.WEAVE_AWARENESS_LAYER_ID;
|
|
21645
21818
|
}
|
|
21646
21819
|
initLayer() {
|
|
21647
21820
|
const stage = this.instance.getStage();
|
|
@@ -21656,7 +21829,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21656
21829
|
}
|
|
21657
21830
|
getLayer() {
|
|
21658
21831
|
const stage = this.instance.getStage();
|
|
21659
|
-
return stage.findOne(`#${
|
|
21832
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21660
21833
|
}
|
|
21661
21834
|
onInit() {
|
|
21662
21835
|
const store = this.instance.getStore();
|
|
@@ -21679,17 +21852,6 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21679
21852
|
};
|
|
21680
21853
|
}
|
|
21681
21854
|
}
|
|
21682
|
-
const allActiveUsersPointers = Object.keys(this.usersPointers).map((userPointerKey) => {
|
|
21683
|
-
const pointerInfo = this.usersPointers[userPointerKey];
|
|
21684
|
-
return pointerInfo.actualPos.user;
|
|
21685
|
-
});
|
|
21686
|
-
const inactivePointers = import_lodash.default.differenceWith(allActiveUsersPointers, allActiveUsers, import_lodash.default.isEqual);
|
|
21687
|
-
const pointersLayer = this.getLayer();
|
|
21688
|
-
for (const inactivePointer of inactivePointers) {
|
|
21689
|
-
const userPointerNode = pointersLayer?.findOne(`#${inactivePointer}`);
|
|
21690
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21691
|
-
delete this.usersPointers[inactivePointer];
|
|
21692
|
-
}
|
|
21693
21855
|
this.renderPointers();
|
|
21694
21856
|
});
|
|
21695
21857
|
stage.on("dragmove", (e) => {
|
|
@@ -21714,111 +21876,96 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21714
21876
|
});
|
|
21715
21877
|
this.renderPointers();
|
|
21716
21878
|
}
|
|
21717
|
-
|
|
21879
|
+
getContrastTextColor(hex) {
|
|
21880
|
+
const cleaned = hex.replace(/^#/, "");
|
|
21881
|
+
const r = parseInt(cleaned.slice(0, 2), 16);
|
|
21882
|
+
const g = parseInt(cleaned.slice(2, 4), 16);
|
|
21883
|
+
const b = parseInt(cleaned.slice(4, 6), 16);
|
|
21884
|
+
const luminance = (.299 * r + .587 * g + .114 * b) / 255;
|
|
21885
|
+
return luminance > .5 ? "black" : "white";
|
|
21886
|
+
}
|
|
21887
|
+
stringToColor(str) {
|
|
21718
21888
|
let hash = 0;
|
|
21719
21889
|
str.split("").forEach((char) => {
|
|
21720
21890
|
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
21721
21891
|
});
|
|
21722
|
-
let
|
|
21892
|
+
let color = "#";
|
|
21723
21893
|
for (let i = 0; i < 3; i++) {
|
|
21724
21894
|
const value = hash >> i * 8 & 255;
|
|
21725
|
-
|
|
21895
|
+
color += value.toString(16).padStart(2, "0");
|
|
21726
21896
|
}
|
|
21727
|
-
return
|
|
21897
|
+
return color;
|
|
21728
21898
|
}
|
|
21729
21899
|
renderPointers() {
|
|
21730
21900
|
const stage = this.instance.getStage();
|
|
21731
21901
|
const pointersLayer = this.getLayer();
|
|
21732
21902
|
if (!this.enabled) return;
|
|
21903
|
+
const pointers = pointersLayer?.find(".pointer") ?? [];
|
|
21904
|
+
for (const pointer of pointers) pointer.destroy();
|
|
21733
21905
|
for (const userPointerKey of Object.keys(this.usersPointers)) {
|
|
21734
21906
|
const userPointer = this.usersPointers[userPointerKey];
|
|
21735
|
-
const userPointerNode =
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
name: "pointer",
|
|
21739
|
-
id: userPointer.actualPos.user,
|
|
21740
|
-
x: userPointer.actualPos.x,
|
|
21741
|
-
y: userPointer.actualPos.y,
|
|
21742
|
-
opacity: 1,
|
|
21743
|
-
listening: false
|
|
21744
|
-
});
|
|
21745
|
-
const userPointNode$1 = new konva.default.Circle({
|
|
21746
|
-
id: "userPoint",
|
|
21747
|
-
x: 0,
|
|
21748
|
-
y: 0,
|
|
21749
|
-
radius: this.userPointerCircleRadius / stage.scaleX(),
|
|
21750
|
-
fill: this.stringToColour(userPointer.actualPos.user),
|
|
21751
|
-
stroke: "black",
|
|
21752
|
-
strokeWidth: this.userPointerCircleStrokeWidth / stage.scaleX(),
|
|
21753
|
-
listening: false
|
|
21754
|
-
});
|
|
21755
|
-
const userNameNode = new konva.default.Text({
|
|
21756
|
-
id: "userPointName",
|
|
21757
|
-
x: (this.userPointerSeparation + this.userPointerBackgroundPaddingX) / stage.scaleX(),
|
|
21758
|
-
y: 0 / stage.scaleX(),
|
|
21759
|
-
height: userPointNode$1.height() * 2 / stage.scaleX(),
|
|
21760
|
-
text: userPointer.actualPos.user,
|
|
21761
|
-
fontSize: this.userPointerNameFontSize / stage.scaleX(),
|
|
21762
|
-
fontFamily: "NotoSansMono, monospace",
|
|
21763
|
-
fill: "black",
|
|
21764
|
-
align: "left",
|
|
21765
|
-
verticalAlign: "middle",
|
|
21766
|
-
listening: false
|
|
21767
|
-
});
|
|
21768
|
-
const userNameBackground = new konva.default.Rect({
|
|
21769
|
-
id: "userPointRect",
|
|
21770
|
-
x: this.userPointerSeparation / stage.scaleX(),
|
|
21771
|
-
y: -this.userPointerBackgroundPaddingY / stage.scaleX(),
|
|
21772
|
-
width: (userNameNode.width() + this.userPointerBackgroundPaddingX * 2) / stage.scaleX(),
|
|
21773
|
-
height: (userNameNode.height() + this.userPointerBackgroundPaddingY * 2) / stage.scaleX(),
|
|
21774
|
-
cornerRadius: this.userPointerBackgroundCornerRadius / stage.scaleX(),
|
|
21775
|
-
fill: "rgba(0,0,0,0.2)",
|
|
21776
|
-
strokeWidth: 0,
|
|
21777
|
-
listening: false
|
|
21778
|
-
});
|
|
21779
|
-
userPointNode$1.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21780
|
-
userPointerNode$1.add(userPointNode$1);
|
|
21781
|
-
userPointerNode$1.add(userNameBackground);
|
|
21782
|
-
userPointerNode$1.add(userNameNode);
|
|
21783
|
-
pointersLayer?.add(userPointerNode$1);
|
|
21784
|
-
continue;
|
|
21785
|
-
}
|
|
21786
|
-
const oldPos = {
|
|
21787
|
-
x: userPointer.oldPos.x,
|
|
21788
|
-
y: userPointer.oldPos.y
|
|
21789
|
-
};
|
|
21790
|
-
const actualPos = {
|
|
21907
|
+
const userPointerNode = new konva.default.Group({
|
|
21908
|
+
name: "pointer",
|
|
21909
|
+
id: `pointer_${userPointer.actualPos.user}`,
|
|
21791
21910
|
x: userPointer.actualPos.x,
|
|
21792
|
-
y: userPointer.actualPos.y
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
radius: this.userPointerCircleRadius / stage.scaleX(),
|
|
21798
|
-
strokeWidth: this.userPointerCircleStrokeWidth / stage.scaleX()
|
|
21911
|
+
y: userPointer.actualPos.y,
|
|
21912
|
+
opacity: 1,
|
|
21913
|
+
listening: false,
|
|
21914
|
+
scaleX: 1 / stage.scaleX(),
|
|
21915
|
+
scaleY: 1 / stage.scaleY()
|
|
21799
21916
|
});
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21917
|
+
userPointerNode.moveToTop();
|
|
21918
|
+
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21919
|
+
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21920
|
+
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21921
|
+
const userPointNode = new konva.default.Circle({
|
|
21922
|
+
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21923
|
+
x: 0,
|
|
21924
|
+
y: 0,
|
|
21925
|
+
radius: circleRadius,
|
|
21926
|
+
fill: userColor,
|
|
21927
|
+
stroke: "black",
|
|
21928
|
+
strokeWidth: circleStrokeWidth,
|
|
21929
|
+
strokeScaleEnabled: false,
|
|
21930
|
+
listening: false
|
|
21806
21931
|
});
|
|
21807
|
-
const
|
|
21808
|
-
|
|
21809
|
-
x:
|
|
21810
|
-
y: -
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21932
|
+
const userNameNode = new konva.default.Text({
|
|
21933
|
+
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21934
|
+
x: separation,
|
|
21935
|
+
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21936
|
+
text: userPointer.actualPos.user.trim(),
|
|
21937
|
+
fontSize,
|
|
21938
|
+
fontFamily,
|
|
21939
|
+
lineHeight: .9,
|
|
21940
|
+
fill: userContrastColor,
|
|
21941
|
+
align: "center",
|
|
21942
|
+
verticalAlign: "middle",
|
|
21943
|
+
listening: false,
|
|
21944
|
+
strokeScaleEnabled: false,
|
|
21945
|
+
ellipsis: true
|
|
21814
21946
|
});
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21947
|
+
const textWidth = userNameNode.getTextWidth();
|
|
21948
|
+
const textHeight = userNameNode.getTextHeight();
|
|
21949
|
+
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21950
|
+
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21951
|
+
const userNameBackground = new konva.default.Rect({
|
|
21952
|
+
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21953
|
+
x: separation,
|
|
21954
|
+
y: -backgroundPaddingY,
|
|
21955
|
+
width: textWidth + backgroundPaddingX * 2,
|
|
21956
|
+
height: textHeight + backgroundPaddingY * 2,
|
|
21957
|
+
cornerRadius: backgroundCornerRadius,
|
|
21958
|
+
fill: userColor,
|
|
21959
|
+
listening: false
|
|
21820
21960
|
});
|
|
21961
|
+
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21962
|
+
userPointerNode.add(userPointNode);
|
|
21963
|
+
userPointerNode.add(userNameBackground);
|
|
21964
|
+
userPointerNode.add(userNameNode);
|
|
21965
|
+
pointersLayer?.add(userPointerNode);
|
|
21821
21966
|
}
|
|
21967
|
+
const selectors = pointersLayer?.find(".selector") ?? [];
|
|
21968
|
+
for (const selector of selectors) selector.moveToBottom();
|
|
21822
21969
|
}
|
|
21823
21970
|
enable() {
|
|
21824
21971
|
this.getLayer()?.show();
|
|
@@ -22248,6 +22395,7 @@ exports.SELECTION_TOOL_STATE = SELECTION_TOOL_STATE
|
|
|
22248
22395
|
exports.TEXT_TOOL_ACTION_NAME = TEXT_TOOL_ACTION_NAME
|
|
22249
22396
|
exports.TEXT_TOOL_STATE = TEXT_TOOL_STATE
|
|
22250
22397
|
exports.WEAVE_COPY_PASTE_NODES_KEY = WEAVE_COPY_PASTE_NODES_KEY
|
|
22398
|
+
exports.WEAVE_DEFAULT_USER_INFO_FUNCTION = WEAVE_DEFAULT_USER_INFO_FUNCTION
|
|
22251
22399
|
exports.WEAVE_FRAME_NODE_DEFAULT_CONFIG = WEAVE_FRAME_NODE_DEFAULT_CONFIG
|
|
22252
22400
|
exports.WEAVE_FRAME_NODE_DEFAULT_PROPS = WEAVE_FRAME_NODE_DEFAULT_PROPS
|
|
22253
22401
|
exports.WEAVE_FRAME_NODE_SIZES = WEAVE_FRAME_NODE_SIZES
|
|
@@ -22265,6 +22413,11 @@ exports.WEAVE_NODES_SELECTION_KEY = WEAVE_NODES_SELECTION_KEY
|
|
|
22265
22413
|
exports.WEAVE_NODES_SELECTION_LAYER_ID = WEAVE_NODES_SELECTION_LAYER_ID
|
|
22266
22414
|
exports.WEAVE_NODES_SNAPPING_KEY = WEAVE_NODES_SNAPPING_KEY
|
|
22267
22415
|
exports.WEAVE_STAGE_GRID_KEY = WEAVE_STAGE_GRID_KEY
|
|
22416
|
+
exports.WEAVE_USERS_POINTERS_KEY = WEAVE_USERS_POINTERS_KEY
|
|
22417
|
+
exports.WEAVE_USERS_SELECTION_KEY = WEAVE_USERS_SELECTION_KEY
|
|
22418
|
+
exports.WEAVE_USER_POINTERS_DEFAULT_PROPS = WEAVE_USER_POINTERS_DEFAULT_PROPS
|
|
22419
|
+
exports.WEAVE_USER_POINTER_KEY = WEAVE_USER_POINTER_KEY
|
|
22420
|
+
exports.WEAVE_USER_SELECTION_KEY = WEAVE_USER_SELECTION_KEY
|
|
22268
22421
|
exports.Weave = Weave
|
|
22269
22422
|
exports.WeaveAction = WeaveAction
|
|
22270
22423
|
exports.WeaveBrushToolAction = WeaveBrushToolAction
|
|
@@ -22301,6 +22454,7 @@ exports.WeaveStore = WeaveStore
|
|
|
22301
22454
|
exports.WeaveTextNode = WeaveTextNode
|
|
22302
22455
|
exports.WeaveTextToolAction = WeaveTextToolAction
|
|
22303
22456
|
exports.WeaveUsersPointersPlugin = WeaveUsersPointersPlugin
|
|
22457
|
+
exports.WeaveUsersSelectionPlugin = WeaveUsersSelectionPlugin
|
|
22304
22458
|
exports.WeaveZoomInToolAction = WeaveZoomInToolAction
|
|
22305
22459
|
exports.WeaveZoomOutToolAction = WeaveZoomOutToolAction
|
|
22306
22460
|
exports.checkIfOverContainer = checkIfOverContainer
|
package/dist/sdk.d.cts
CHANGED
|
@@ -436,7 +436,7 @@ declare class Weave extends Emittery {
|
|
|
436
436
|
bringToFront(node: WeaveElementInstance): void;
|
|
437
437
|
group(nodes: WeaveStateElement[]): void;
|
|
438
438
|
unGroup(group: WeaveStateElement): void;
|
|
439
|
-
pointIntersectsContainerElement(point?: Vector2d): Konva.Node | undefined;
|
|
439
|
+
pointIntersectsContainerElement(actualLayer?: Konva.Layer | Konva.Group, point?: Vector2d): Konva.Node | undefined;
|
|
440
440
|
getMousePointer(point?: Vector2d): WeaveMousePointInfo;
|
|
441
441
|
getMousePointerRelativeToContainer(container: Konva.Group | Konva.Layer): WeaveMousePointInfoSimple;
|
|
442
442
|
selectNodesByKey(nodesIds: string[]): void;
|
|
@@ -1278,14 +1278,88 @@ declare class WeaveConnectedUsersPlugin extends WeavePlugin {
|
|
|
1278
1278
|
disable(): void;
|
|
1279
1279
|
}
|
|
1280
1280
|
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/plugins/users-selection/constants.d.ts
|
|
1283
|
+
declare const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
1284
|
+
declare const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
1285
|
+
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region src/plugins/users-selection/types.d.ts
|
|
1288
|
+
type WeaveUsersSelectionPluginConfig = {
|
|
1289
|
+
getUser: () => WeaveUser;
|
|
1290
|
+
};
|
|
1291
|
+
type WeaveUsersSelectionPluginParams = {
|
|
1292
|
+
config: WeaveUsersSelectionPluginConfig;
|
|
1293
|
+
};
|
|
1294
|
+
type WeaveUserSelectionInfo = {
|
|
1295
|
+
user: string;
|
|
1296
|
+
nodes: string[];
|
|
1297
|
+
};
|
|
1298
|
+
type WeaveUserSelectionKey = typeof WEAVE_USER_SELECTION_KEY;
|
|
1299
|
+
|
|
1300
|
+
//#endregion
|
|
1301
|
+
//#region src/plugins/users-selection/users-selection.d.ts
|
|
1302
|
+
declare class WeaveUsersSelectionPlugin extends WeavePlugin {
|
|
1303
|
+
private usersSelection;
|
|
1304
|
+
private config;
|
|
1305
|
+
constructor(params: WeaveUsersSelectionPluginParams);
|
|
1306
|
+
getName(): string;
|
|
1307
|
+
getLayerName(): string;
|
|
1308
|
+
initLayer(): void;
|
|
1309
|
+
onRender(): void;
|
|
1310
|
+
getLayer(): Konva.Layer | undefined;
|
|
1311
|
+
onInit(): void;
|
|
1312
|
+
sendSelectionAwarenessInfo(tr: Konva.Transformer): void;
|
|
1313
|
+
removeSelectionAwarenessInfo(): void;
|
|
1314
|
+
private stringToColor;
|
|
1315
|
+
private getSelectedNodesRect;
|
|
1316
|
+
private renderSelectors;
|
|
1317
|
+
enable(): void;
|
|
1318
|
+
disable(): void;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1281
1321
|
//#endregion
|
|
1282
1322
|
//#region src/plugins/users-pointers/constants.d.ts
|
|
1323
|
+
declare const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
1283
1324
|
declare const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
1325
|
+
declare const WEAVE_DEFAULT_USER_INFO_FUNCTION: () => {
|
|
1326
|
+
name: string;
|
|
1327
|
+
email: string;
|
|
1328
|
+
};
|
|
1329
|
+
declare const WEAVE_USER_POINTERS_DEFAULT_PROPS: {
|
|
1330
|
+
separation: number;
|
|
1331
|
+
pointer: {
|
|
1332
|
+
circleRadius: number;
|
|
1333
|
+
circleStrokeWidth: number;
|
|
1334
|
+
};
|
|
1335
|
+
name: {
|
|
1336
|
+
fontFamily: string;
|
|
1337
|
+
fontSize: number;
|
|
1338
|
+
backgroundCornerRadius: number;
|
|
1339
|
+
backgroundPaddingX: number;
|
|
1340
|
+
backgroundPaddingY: number;
|
|
1341
|
+
};
|
|
1342
|
+
};
|
|
1284
1343
|
|
|
1285
1344
|
//#endregion
|
|
1286
1345
|
//#region src/plugins/users-pointers/types.d.ts
|
|
1346
|
+
type WeaveUserPointersUIProperties = {
|
|
1347
|
+
separation: number;
|
|
1348
|
+
pointer: {
|
|
1349
|
+
circleRadius: number;
|
|
1350
|
+
circleStrokeWidth: number;
|
|
1351
|
+
};
|
|
1352
|
+
name: {
|
|
1353
|
+
fontFamily: string;
|
|
1354
|
+
fontSize: number;
|
|
1355
|
+
backgroundCornerRadius: number;
|
|
1356
|
+
backgroundPaddingX: number;
|
|
1357
|
+
backgroundPaddingY: number;
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1287
1360
|
type WeaveUsersPointersPluginConfig = {
|
|
1288
1361
|
getUser: () => WeaveUser;
|
|
1362
|
+
ui?: WeaveUserPointersUIProperties;
|
|
1289
1363
|
};
|
|
1290
1364
|
type WeaveUsersPointersPluginParams = {
|
|
1291
1365
|
config: WeaveUsersPointersPluginConfig;
|
|
@@ -1302,13 +1376,7 @@ type WeaveUserPointerKey = typeof WEAVE_USER_POINTER_KEY;
|
|
|
1302
1376
|
declare class WeaveUsersPointersPlugin extends WeavePlugin {
|
|
1303
1377
|
private usersPointers;
|
|
1304
1378
|
private config;
|
|
1305
|
-
private
|
|
1306
|
-
private userPointerSeparation;
|
|
1307
|
-
private userPointerCircleStrokeWidth;
|
|
1308
|
-
private userPointerNameFontSize;
|
|
1309
|
-
private userPointerBackgroundCornerRadius;
|
|
1310
|
-
private userPointerBackgroundPaddingX;
|
|
1311
|
-
private userPointerBackgroundPaddingY;
|
|
1379
|
+
private uiConfig;
|
|
1312
1380
|
constructor(params: WeaveUsersPointersPluginParams);
|
|
1313
1381
|
getName(): string;
|
|
1314
1382
|
getLayerName(): string;
|
|
@@ -1316,7 +1384,8 @@ declare class WeaveUsersPointersPlugin extends WeavePlugin {
|
|
|
1316
1384
|
onRender(): void;
|
|
1317
1385
|
getLayer(): Konva.Layer | undefined;
|
|
1318
1386
|
onInit(): void;
|
|
1319
|
-
private
|
|
1387
|
+
private getContrastTextColor;
|
|
1388
|
+
private stringToColor;
|
|
1320
1389
|
private renderPointers;
|
|
1321
1390
|
enable(): void;
|
|
1322
1391
|
disable(): void;
|
|
@@ -1514,4 +1583,4 @@ declare class WeaveNodesSnappingPlugin extends WeavePlugin {
|
|
|
1514
1583
|
}
|
|
1515
1584
|
|
|
1516
1585
|
//#endregion
|
|
1517
|
-
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_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, 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, WeaveUsersPointersPlugin, WeaveUsersPointersPluginConfig, WeaveUsersPointersPluginParams, WeaveZoomInToolAction, WeaveZoomInToolActionParams, WeaveZoomOutToolAction, WeaveZoomOutToolActionParams, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
|
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
|
@@ -436,7 +436,7 @@ declare class Weave extends Emittery {
|
|
|
436
436
|
bringToFront(node: WeaveElementInstance): void;
|
|
437
437
|
group(nodes: WeaveStateElement[]): void;
|
|
438
438
|
unGroup(group: WeaveStateElement): void;
|
|
439
|
-
pointIntersectsContainerElement(point?: Vector2d): Konva.Node | undefined;
|
|
439
|
+
pointIntersectsContainerElement(actualLayer?: Konva.Layer | Konva.Group, point?: Vector2d): Konva.Node | undefined;
|
|
440
440
|
getMousePointer(point?: Vector2d): WeaveMousePointInfo;
|
|
441
441
|
getMousePointerRelativeToContainer(container: Konva.Group | Konva.Layer): WeaveMousePointInfoSimple;
|
|
442
442
|
selectNodesByKey(nodesIds: string[]): void;
|
|
@@ -1278,14 +1278,88 @@ declare class WeaveConnectedUsersPlugin extends WeavePlugin {
|
|
|
1278
1278
|
disable(): void;
|
|
1279
1279
|
}
|
|
1280
1280
|
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/plugins/users-selection/constants.d.ts
|
|
1283
|
+
declare const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
1284
|
+
declare const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
1285
|
+
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region src/plugins/users-selection/types.d.ts
|
|
1288
|
+
type WeaveUsersSelectionPluginConfig = {
|
|
1289
|
+
getUser: () => WeaveUser;
|
|
1290
|
+
};
|
|
1291
|
+
type WeaveUsersSelectionPluginParams = {
|
|
1292
|
+
config: WeaveUsersSelectionPluginConfig;
|
|
1293
|
+
};
|
|
1294
|
+
type WeaveUserSelectionInfo = {
|
|
1295
|
+
user: string;
|
|
1296
|
+
nodes: string[];
|
|
1297
|
+
};
|
|
1298
|
+
type WeaveUserSelectionKey = typeof WEAVE_USER_SELECTION_KEY;
|
|
1299
|
+
|
|
1300
|
+
//#endregion
|
|
1301
|
+
//#region src/plugins/users-selection/users-selection.d.ts
|
|
1302
|
+
declare class WeaveUsersSelectionPlugin extends WeavePlugin {
|
|
1303
|
+
private usersSelection;
|
|
1304
|
+
private config;
|
|
1305
|
+
constructor(params: WeaveUsersSelectionPluginParams);
|
|
1306
|
+
getName(): string;
|
|
1307
|
+
getLayerName(): string;
|
|
1308
|
+
initLayer(): void;
|
|
1309
|
+
onRender(): void;
|
|
1310
|
+
getLayer(): Konva.Layer | undefined;
|
|
1311
|
+
onInit(): void;
|
|
1312
|
+
sendSelectionAwarenessInfo(tr: Konva.Transformer): void;
|
|
1313
|
+
removeSelectionAwarenessInfo(): void;
|
|
1314
|
+
private stringToColor;
|
|
1315
|
+
private getSelectedNodesRect;
|
|
1316
|
+
private renderSelectors;
|
|
1317
|
+
enable(): void;
|
|
1318
|
+
disable(): void;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1281
1321
|
//#endregion
|
|
1282
1322
|
//#region src/plugins/users-pointers/constants.d.ts
|
|
1323
|
+
declare const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
1283
1324
|
declare const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
1325
|
+
declare const WEAVE_DEFAULT_USER_INFO_FUNCTION: () => {
|
|
1326
|
+
name: string;
|
|
1327
|
+
email: string;
|
|
1328
|
+
};
|
|
1329
|
+
declare const WEAVE_USER_POINTERS_DEFAULT_PROPS: {
|
|
1330
|
+
separation: number;
|
|
1331
|
+
pointer: {
|
|
1332
|
+
circleRadius: number;
|
|
1333
|
+
circleStrokeWidth: number;
|
|
1334
|
+
};
|
|
1335
|
+
name: {
|
|
1336
|
+
fontFamily: string;
|
|
1337
|
+
fontSize: number;
|
|
1338
|
+
backgroundCornerRadius: number;
|
|
1339
|
+
backgroundPaddingX: number;
|
|
1340
|
+
backgroundPaddingY: number;
|
|
1341
|
+
};
|
|
1342
|
+
};
|
|
1284
1343
|
|
|
1285
1344
|
//#endregion
|
|
1286
1345
|
//#region src/plugins/users-pointers/types.d.ts
|
|
1346
|
+
type WeaveUserPointersUIProperties = {
|
|
1347
|
+
separation: number;
|
|
1348
|
+
pointer: {
|
|
1349
|
+
circleRadius: number;
|
|
1350
|
+
circleStrokeWidth: number;
|
|
1351
|
+
};
|
|
1352
|
+
name: {
|
|
1353
|
+
fontFamily: string;
|
|
1354
|
+
fontSize: number;
|
|
1355
|
+
backgroundCornerRadius: number;
|
|
1356
|
+
backgroundPaddingX: number;
|
|
1357
|
+
backgroundPaddingY: number;
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1287
1360
|
type WeaveUsersPointersPluginConfig = {
|
|
1288
1361
|
getUser: () => WeaveUser;
|
|
1362
|
+
ui?: WeaveUserPointersUIProperties;
|
|
1289
1363
|
};
|
|
1290
1364
|
type WeaveUsersPointersPluginParams = {
|
|
1291
1365
|
config: WeaveUsersPointersPluginConfig;
|
|
@@ -1302,13 +1376,7 @@ type WeaveUserPointerKey = typeof WEAVE_USER_POINTER_KEY;
|
|
|
1302
1376
|
declare class WeaveUsersPointersPlugin extends WeavePlugin {
|
|
1303
1377
|
private usersPointers;
|
|
1304
1378
|
private config;
|
|
1305
|
-
private
|
|
1306
|
-
private userPointerSeparation;
|
|
1307
|
-
private userPointerCircleStrokeWidth;
|
|
1308
|
-
private userPointerNameFontSize;
|
|
1309
|
-
private userPointerBackgroundCornerRadius;
|
|
1310
|
-
private userPointerBackgroundPaddingX;
|
|
1311
|
-
private userPointerBackgroundPaddingY;
|
|
1379
|
+
private uiConfig;
|
|
1312
1380
|
constructor(params: WeaveUsersPointersPluginParams);
|
|
1313
1381
|
getName(): string;
|
|
1314
1382
|
getLayerName(): string;
|
|
@@ -1316,7 +1384,8 @@ declare class WeaveUsersPointersPlugin extends WeavePlugin {
|
|
|
1316
1384
|
onRender(): void;
|
|
1317
1385
|
getLayer(): Konva.Layer | undefined;
|
|
1318
1386
|
onInit(): void;
|
|
1319
|
-
private
|
|
1387
|
+
private getContrastTextColor;
|
|
1388
|
+
private stringToColor;
|
|
1320
1389
|
private renderPointers;
|
|
1321
1390
|
enable(): void;
|
|
1322
1391
|
disable(): void;
|
|
@@ -1514,4 +1583,4 @@ declare class WeaveNodesSnappingPlugin extends WeavePlugin {
|
|
|
1514
1583
|
}
|
|
1515
1584
|
|
|
1516
1585
|
//#endregion
|
|
1517
|
-
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_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, 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, WeaveUsersPointersPlugin, WeaveUsersPointersPluginConfig, WeaveUsersPointersPluginParams, WeaveZoomInToolAction, WeaveZoomInToolActionParams, WeaveZoomOutToolAction, WeaveZoomOutToolActionParams, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
|
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";
|
|
@@ -15761,7 +15761,7 @@ function clearContainerTargets(instance) {
|
|
|
15761
15761
|
for (const container of getContainers) container.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
|
|
15762
15762
|
}
|
|
15763
15763
|
function checkIfOverContainer(instance, node) {
|
|
15764
|
-
const nodesIntersected = instance.pointIntersectsContainerElement();
|
|
15764
|
+
const nodesIntersected = instance.pointIntersectsContainerElement(node.getParent());
|
|
15765
15765
|
let nodeActualContainer = node.getParent();
|
|
15766
15766
|
if (nodeActualContainer?.getAttrs().nodeId) nodeActualContainer = instance.getStage().findOne(`#${nodeActualContainer.getAttrs().nodeId}`);
|
|
15767
15767
|
let layerToMove = void 0;
|
|
@@ -15791,6 +15791,11 @@ function moveNodeToContainer(instance, node) {
|
|
|
15791
15791
|
return layerToMove;
|
|
15792
15792
|
}
|
|
15793
15793
|
|
|
15794
|
+
//#endregion
|
|
15795
|
+
//#region src/plugins/users-selection/constants.ts
|
|
15796
|
+
const WEAVE_USERS_SELECTION_KEY = "usersSelection";
|
|
15797
|
+
const WEAVE_USER_SELECTION_KEY = "userSelection";
|
|
15798
|
+
|
|
15794
15799
|
//#endregion
|
|
15795
15800
|
//#region src/plugins/nodes-selection/nodes-selection.ts
|
|
15796
15801
|
var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
@@ -15955,6 +15960,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15955
15960
|
node: nodeHandler.serialize(node)
|
|
15956
15961
|
};
|
|
15957
15962
|
});
|
|
15963
|
+
const usersSelectionPlugin = this.instance.getPlugin(WEAVE_USERS_SELECTION_KEY);
|
|
15964
|
+
if (usersSelectionPlugin) usersSelectionPlugin.sendSelectionAwarenessInfo(this.tr);
|
|
15958
15965
|
this.instance.emitEvent("onNodesChange", selectedNodes);
|
|
15959
15966
|
}
|
|
15960
15967
|
removeSelectedNodes() {
|
|
@@ -17131,7 +17138,7 @@ var WeaveTargetingManager = class {
|
|
|
17131
17138
|
this.logger = this.instance.getChildLogger("targeting-manager");
|
|
17132
17139
|
this.logger.debug("Targeting manager created");
|
|
17133
17140
|
}
|
|
17134
|
-
pointIntersectsContainerElement(point) {
|
|
17141
|
+
pointIntersectsContainerElement(actualLayer, point) {
|
|
17135
17142
|
const stage = this.instance.getStage();
|
|
17136
17143
|
const relativeMousePointer = point ? point : stage.getPointerPosition() ?? {
|
|
17137
17144
|
x: 0,
|
|
@@ -17143,11 +17150,11 @@ var WeaveTargetingManager = class {
|
|
|
17143
17150
|
if (node.getAttrs().nodeId) {
|
|
17144
17151
|
const parent = stage.findOne(`#${node.getAttrs().nodeId}`);
|
|
17145
17152
|
intersectedNode = parent;
|
|
17146
|
-
|
|
17153
|
+
continue;
|
|
17147
17154
|
}
|
|
17148
|
-
if (node.getAttrs().containerId) {
|
|
17155
|
+
if (node.getAttrs().containerId && node.getAttrs().id !== actualLayer?.getAttrs().id) {
|
|
17149
17156
|
intersectedNode = node;
|
|
17150
|
-
|
|
17157
|
+
continue;
|
|
17151
17158
|
}
|
|
17152
17159
|
}
|
|
17153
17160
|
return intersectedNode;
|
|
@@ -17912,7 +17919,7 @@ var WeaveRegisterManager = class {
|
|
|
17912
17919
|
|
|
17913
17920
|
//#endregion
|
|
17914
17921
|
//#region package.json
|
|
17915
|
-
var version = "0.
|
|
17922
|
+
var version = "0.16.1";
|
|
17916
17923
|
|
|
17917
17924
|
//#endregion
|
|
17918
17925
|
//#region src/managers/setup.ts
|
|
@@ -18518,8 +18525,8 @@ var Weave = class extends Emittery {
|
|
|
18518
18525
|
unGroup(group) {
|
|
18519
18526
|
this.groupsManager.unGroup(group);
|
|
18520
18527
|
}
|
|
18521
|
-
pointIntersectsContainerElement(point) {
|
|
18522
|
-
return this.targetingManager.pointIntersectsContainerElement(point);
|
|
18528
|
+
pointIntersectsContainerElement(actualLayer, point) {
|
|
18529
|
+
return this.targetingManager.pointIntersectsContainerElement(actualLayer, point);
|
|
18523
18530
|
}
|
|
18524
18531
|
getMousePointer(point) {
|
|
18525
18532
|
return this.targetingManager.getMousePointer(point);
|
|
@@ -21615,33 +21622,199 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
21615
21622
|
}
|
|
21616
21623
|
};
|
|
21617
21624
|
|
|
21625
|
+
//#endregion
|
|
21626
|
+
//#region src/plugins/users-selection/users-selection.ts
|
|
21627
|
+
var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
21628
|
+
constructor(params) {
|
|
21629
|
+
super();
|
|
21630
|
+
const { config } = params;
|
|
21631
|
+
this.config = config;
|
|
21632
|
+
this.usersSelection = {};
|
|
21633
|
+
}
|
|
21634
|
+
getName() {
|
|
21635
|
+
return WEAVE_USERS_SELECTION_KEY;
|
|
21636
|
+
}
|
|
21637
|
+
getLayerName() {
|
|
21638
|
+
return WEAVE_AWARENESS_LAYER_ID;
|
|
21639
|
+
}
|
|
21640
|
+
initLayer() {
|
|
21641
|
+
const stage = this.instance.getStage();
|
|
21642
|
+
const layer = new Konva.Layer({
|
|
21643
|
+
id: this.getLayerName(),
|
|
21644
|
+
listening: false
|
|
21645
|
+
});
|
|
21646
|
+
stage.add(layer);
|
|
21647
|
+
}
|
|
21648
|
+
onRender() {
|
|
21649
|
+
this.renderSelectors();
|
|
21650
|
+
}
|
|
21651
|
+
getLayer() {
|
|
21652
|
+
const stage = this.instance.getStage();
|
|
21653
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21654
|
+
}
|
|
21655
|
+
onInit() {
|
|
21656
|
+
this.instance.addEventListener("onAwarenessChange", (changes) => {
|
|
21657
|
+
const selfUser = this.config.getUser();
|
|
21658
|
+
const allActiveUsers = [];
|
|
21659
|
+
for (const change of changes) {
|
|
21660
|
+
if (!change[WEAVE_USER_SELECTION_KEY]) continue;
|
|
21661
|
+
if (change[WEAVE_USER_SELECTION_KEY] && selfUser.name !== change[WEAVE_USER_SELECTION_KEY].user) {
|
|
21662
|
+
const userSelection = change[WEAVE_USER_SELECTION_KEY];
|
|
21663
|
+
allActiveUsers.push(userSelection.user);
|
|
21664
|
+
this.usersSelection[userSelection.user] = {
|
|
21665
|
+
oldNodes: this.usersSelection[userSelection.user]?.actualNodes ?? {
|
|
21666
|
+
user: userSelection.user,
|
|
21667
|
+
nodes: []
|
|
21668
|
+
},
|
|
21669
|
+
actualNodes: userSelection
|
|
21670
|
+
};
|
|
21671
|
+
}
|
|
21672
|
+
}
|
|
21673
|
+
this.renderSelectors();
|
|
21674
|
+
});
|
|
21675
|
+
this.renderSelectors();
|
|
21676
|
+
}
|
|
21677
|
+
sendSelectionAwarenessInfo(tr) {
|
|
21678
|
+
const userInfo = this.config.getUser();
|
|
21679
|
+
const store = this.instance.getStore();
|
|
21680
|
+
store.setAwarenessInfo(WEAVE_USER_SELECTION_KEY, {
|
|
21681
|
+
user: userInfo.name,
|
|
21682
|
+
nodes: tr.nodes().map((node) => node.getAttrs().id)
|
|
21683
|
+
});
|
|
21684
|
+
}
|
|
21685
|
+
removeSelectionAwarenessInfo() {
|
|
21686
|
+
const store = this.instance.getStore();
|
|
21687
|
+
store.setAwarenessInfo(WEAVE_USER_SELECTION_KEY, void 0);
|
|
21688
|
+
}
|
|
21689
|
+
stringToColor(str) {
|
|
21690
|
+
let hash = 0;
|
|
21691
|
+
str.split("").forEach((char) => {
|
|
21692
|
+
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
21693
|
+
});
|
|
21694
|
+
let color = "#";
|
|
21695
|
+
for (let i = 0; i < 3; i++) {
|
|
21696
|
+
const value = hash >> i * 8 & 255;
|
|
21697
|
+
color += value.toString(16).padStart(2, "0");
|
|
21698
|
+
}
|
|
21699
|
+
return color;
|
|
21700
|
+
}
|
|
21701
|
+
getSelectedNodesRect(nodes) {
|
|
21702
|
+
const stage = this.instance.getStage();
|
|
21703
|
+
const maxPoint = {
|
|
21704
|
+
x: -Infinity,
|
|
21705
|
+
y: -Infinity
|
|
21706
|
+
};
|
|
21707
|
+
const minPoint = {
|
|
21708
|
+
x: Infinity,
|
|
21709
|
+
y: Infinity
|
|
21710
|
+
};
|
|
21711
|
+
for (const nodeId of nodes) {
|
|
21712
|
+
const node = stage.findOne(`#${nodeId}`);
|
|
21713
|
+
if (node) {
|
|
21714
|
+
const nodeRect = node.getClientRect({
|
|
21715
|
+
relativeTo: stage,
|
|
21716
|
+
skipStroke: true
|
|
21717
|
+
});
|
|
21718
|
+
if (nodeRect.x < minPoint.x) minPoint.x = nodeRect.x;
|
|
21719
|
+
if (nodeRect.y < minPoint.y) minPoint.y = nodeRect.y;
|
|
21720
|
+
if (nodeRect.x + nodeRect.width > maxPoint.x) maxPoint.x = nodeRect.x + nodeRect.width;
|
|
21721
|
+
if (nodeRect.y + nodeRect.height > maxPoint.y) maxPoint.y = nodeRect.y + nodeRect.height;
|
|
21722
|
+
}
|
|
21723
|
+
}
|
|
21724
|
+
return {
|
|
21725
|
+
x: minPoint.x,
|
|
21726
|
+
y: minPoint.y,
|
|
21727
|
+
width: Math.abs(maxPoint.x - minPoint.x) * stage.scaleX(),
|
|
21728
|
+
height: Math.abs(maxPoint.y - minPoint.y) * stage.scaleY()
|
|
21729
|
+
};
|
|
21730
|
+
}
|
|
21731
|
+
renderSelectors() {
|
|
21732
|
+
const stage = this.instance.getStage();
|
|
21733
|
+
const selectorsLayer = this.getLayer();
|
|
21734
|
+
if (!this.enabled) return;
|
|
21735
|
+
const selectors = selectorsLayer?.find(".selector") ?? [];
|
|
21736
|
+
for (const selector of selectors) selector.destroy();
|
|
21737
|
+
for (const userPointerKey of Object.keys(this.usersSelection)) {
|
|
21738
|
+
const userSelector = this.usersSelection[userPointerKey];
|
|
21739
|
+
const selectionRect = this.getSelectedNodesRect(userSelector.actualNodes.nodes);
|
|
21740
|
+
const userSelectorNode = new Konva.Group({
|
|
21741
|
+
name: "selector",
|
|
21742
|
+
id: `selector_${userSelector.actualNodes.user}`,
|
|
21743
|
+
x: selectionRect.x,
|
|
21744
|
+
y: selectionRect.y,
|
|
21745
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21746
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21747
|
+
listening: false
|
|
21748
|
+
});
|
|
21749
|
+
userSelectorNode.moveToBottom();
|
|
21750
|
+
const userSelectorRect = new Konva.Rect({
|
|
21751
|
+
x: 0,
|
|
21752
|
+
y: 0,
|
|
21753
|
+
id: `selector_${userSelector.actualNodes.user}_rect`,
|
|
21754
|
+
width: selectionRect.width / stage.scaleX(),
|
|
21755
|
+
height: selectionRect.height / stage.scaleY(),
|
|
21756
|
+
fill: "transparent",
|
|
21757
|
+
stroke: this.stringToColor(userSelector.actualNodes.user),
|
|
21758
|
+
strokeWidth: 3,
|
|
21759
|
+
strokeScaleEnabled: false
|
|
21760
|
+
});
|
|
21761
|
+
userSelectorNode.add(userSelectorRect);
|
|
21762
|
+
selectorsLayer?.add(userSelectorNode);
|
|
21763
|
+
}
|
|
21764
|
+
const pointers = selectorsLayer?.find(".pointer") ?? [];
|
|
21765
|
+
for (const pointer of pointers) pointer.moveToTop();
|
|
21766
|
+
}
|
|
21767
|
+
enable() {
|
|
21768
|
+
this.getLayer()?.show();
|
|
21769
|
+
this.enabled = true;
|
|
21770
|
+
}
|
|
21771
|
+
disable() {
|
|
21772
|
+
this.getLayer()?.hide();
|
|
21773
|
+
this.enabled = false;
|
|
21774
|
+
}
|
|
21775
|
+
};
|
|
21776
|
+
|
|
21618
21777
|
//#endregion
|
|
21619
21778
|
//#region src/plugins/users-pointers/constants.ts
|
|
21620
21779
|
const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
21621
|
-
const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
21622
21780
|
const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
21781
|
+
const WEAVE_DEFAULT_USER_INFO_FUNCTION = () => ({
|
|
21782
|
+
name: "Unknown",
|
|
21783
|
+
email: "unknown@domain.com"
|
|
21784
|
+
});
|
|
21785
|
+
const WEAVE_USER_POINTERS_DEFAULT_PROPS = {
|
|
21786
|
+
separation: 8,
|
|
21787
|
+
pointer: {
|
|
21788
|
+
circleRadius: 4,
|
|
21789
|
+
circleStrokeWidth: 0
|
|
21790
|
+
},
|
|
21791
|
+
name: {
|
|
21792
|
+
fontFamily: "Arial",
|
|
21793
|
+
fontSize: 10,
|
|
21794
|
+
backgroundCornerRadius: 0,
|
|
21795
|
+
backgroundPaddingX: 8,
|
|
21796
|
+
backgroundPaddingY: 4
|
|
21797
|
+
}
|
|
21798
|
+
};
|
|
21623
21799
|
|
|
21624
21800
|
//#endregion
|
|
21625
21801
|
//#region src/plugins/users-pointers/users-pointers.ts
|
|
21626
21802
|
var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
21627
|
-
userPointerCircleRadius = 4;
|
|
21628
|
-
userPointerSeparation = 8;
|
|
21629
|
-
userPointerCircleStrokeWidth = 1;
|
|
21630
|
-
userPointerNameFontSize = 10;
|
|
21631
|
-
userPointerBackgroundCornerRadius = 4;
|
|
21632
|
-
userPointerBackgroundPaddingX = 4;
|
|
21633
|
-
userPointerBackgroundPaddingY = 8;
|
|
21634
21803
|
constructor(params) {
|
|
21635
21804
|
super();
|
|
21636
21805
|
const { config } = params;
|
|
21637
|
-
this.usersPointers = {};
|
|
21638
21806
|
this.config = config;
|
|
21807
|
+
this.uiConfig = {
|
|
21808
|
+
...WEAVE_USER_POINTERS_DEFAULT_PROPS,
|
|
21809
|
+
...this.config.ui
|
|
21810
|
+
};
|
|
21811
|
+
this.usersPointers = {};
|
|
21639
21812
|
}
|
|
21640
21813
|
getName() {
|
|
21641
21814
|
return WEAVE_USERS_POINTERS_KEY;
|
|
21642
21815
|
}
|
|
21643
21816
|
getLayerName() {
|
|
21644
|
-
return
|
|
21817
|
+
return WEAVE_AWARENESS_LAYER_ID;
|
|
21645
21818
|
}
|
|
21646
21819
|
initLayer() {
|
|
21647
21820
|
const stage = this.instance.getStage();
|
|
@@ -21656,7 +21829,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21656
21829
|
}
|
|
21657
21830
|
getLayer() {
|
|
21658
21831
|
const stage = this.instance.getStage();
|
|
21659
|
-
return stage.findOne(`#${
|
|
21832
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
21660
21833
|
}
|
|
21661
21834
|
onInit() {
|
|
21662
21835
|
const store = this.instance.getStore();
|
|
@@ -21679,17 +21852,6 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21679
21852
|
};
|
|
21680
21853
|
}
|
|
21681
21854
|
}
|
|
21682
|
-
const allActiveUsersPointers = Object.keys(this.usersPointers).map((userPointerKey) => {
|
|
21683
|
-
const pointerInfo = this.usersPointers[userPointerKey];
|
|
21684
|
-
return pointerInfo.actualPos.user;
|
|
21685
|
-
});
|
|
21686
|
-
const inactivePointers = import_lodash.default.differenceWith(allActiveUsersPointers, allActiveUsers, import_lodash.default.isEqual);
|
|
21687
|
-
const pointersLayer = this.getLayer();
|
|
21688
|
-
for (const inactivePointer of inactivePointers) {
|
|
21689
|
-
const userPointerNode = pointersLayer?.findOne(`#${inactivePointer}`);
|
|
21690
|
-
if (userPointerNode) userPointerNode.destroy();
|
|
21691
|
-
delete this.usersPointers[inactivePointer];
|
|
21692
|
-
}
|
|
21693
21855
|
this.renderPointers();
|
|
21694
21856
|
});
|
|
21695
21857
|
stage.on("dragmove", (e) => {
|
|
@@ -21714,111 +21876,96 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21714
21876
|
});
|
|
21715
21877
|
this.renderPointers();
|
|
21716
21878
|
}
|
|
21717
|
-
|
|
21879
|
+
getContrastTextColor(hex) {
|
|
21880
|
+
const cleaned = hex.replace(/^#/, "");
|
|
21881
|
+
const r = parseInt(cleaned.slice(0, 2), 16);
|
|
21882
|
+
const g = parseInt(cleaned.slice(2, 4), 16);
|
|
21883
|
+
const b = parseInt(cleaned.slice(4, 6), 16);
|
|
21884
|
+
const luminance = (.299 * r + .587 * g + .114 * b) / 255;
|
|
21885
|
+
return luminance > .5 ? "black" : "white";
|
|
21886
|
+
}
|
|
21887
|
+
stringToColor(str) {
|
|
21718
21888
|
let hash = 0;
|
|
21719
21889
|
str.split("").forEach((char) => {
|
|
21720
21890
|
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
21721
21891
|
});
|
|
21722
|
-
let
|
|
21892
|
+
let color = "#";
|
|
21723
21893
|
for (let i = 0; i < 3; i++) {
|
|
21724
21894
|
const value = hash >> i * 8 & 255;
|
|
21725
|
-
|
|
21895
|
+
color += value.toString(16).padStart(2, "0");
|
|
21726
21896
|
}
|
|
21727
|
-
return
|
|
21897
|
+
return color;
|
|
21728
21898
|
}
|
|
21729
21899
|
renderPointers() {
|
|
21730
21900
|
const stage = this.instance.getStage();
|
|
21731
21901
|
const pointersLayer = this.getLayer();
|
|
21732
21902
|
if (!this.enabled) return;
|
|
21903
|
+
const pointers = pointersLayer?.find(".pointer") ?? [];
|
|
21904
|
+
for (const pointer of pointers) pointer.destroy();
|
|
21733
21905
|
for (const userPointerKey of Object.keys(this.usersPointers)) {
|
|
21734
21906
|
const userPointer = this.usersPointers[userPointerKey];
|
|
21735
|
-
const userPointerNode =
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
name: "pointer",
|
|
21739
|
-
id: userPointer.actualPos.user,
|
|
21740
|
-
x: userPointer.actualPos.x,
|
|
21741
|
-
y: userPointer.actualPos.y,
|
|
21742
|
-
opacity: 1,
|
|
21743
|
-
listening: false
|
|
21744
|
-
});
|
|
21745
|
-
const userPointNode$1 = new Konva.Circle({
|
|
21746
|
-
id: "userPoint",
|
|
21747
|
-
x: 0,
|
|
21748
|
-
y: 0,
|
|
21749
|
-
radius: this.userPointerCircleRadius / stage.scaleX(),
|
|
21750
|
-
fill: this.stringToColour(userPointer.actualPos.user),
|
|
21751
|
-
stroke: "black",
|
|
21752
|
-
strokeWidth: this.userPointerCircleStrokeWidth / stage.scaleX(),
|
|
21753
|
-
listening: false
|
|
21754
|
-
});
|
|
21755
|
-
const userNameNode = new Konva.Text({
|
|
21756
|
-
id: "userPointName",
|
|
21757
|
-
x: (this.userPointerSeparation + this.userPointerBackgroundPaddingX) / stage.scaleX(),
|
|
21758
|
-
y: 0 / stage.scaleX(),
|
|
21759
|
-
height: userPointNode$1.height() * 2 / stage.scaleX(),
|
|
21760
|
-
text: userPointer.actualPos.user,
|
|
21761
|
-
fontSize: this.userPointerNameFontSize / stage.scaleX(),
|
|
21762
|
-
fontFamily: "NotoSansMono, monospace",
|
|
21763
|
-
fill: "black",
|
|
21764
|
-
align: "left",
|
|
21765
|
-
verticalAlign: "middle",
|
|
21766
|
-
listening: false
|
|
21767
|
-
});
|
|
21768
|
-
const userNameBackground = new Konva.Rect({
|
|
21769
|
-
id: "userPointRect",
|
|
21770
|
-
x: this.userPointerSeparation / stage.scaleX(),
|
|
21771
|
-
y: -this.userPointerBackgroundPaddingY / stage.scaleX(),
|
|
21772
|
-
width: (userNameNode.width() + this.userPointerBackgroundPaddingX * 2) / stage.scaleX(),
|
|
21773
|
-
height: (userNameNode.height() + this.userPointerBackgroundPaddingY * 2) / stage.scaleX(),
|
|
21774
|
-
cornerRadius: this.userPointerBackgroundCornerRadius / stage.scaleX(),
|
|
21775
|
-
fill: "rgba(0,0,0,0.2)",
|
|
21776
|
-
strokeWidth: 0,
|
|
21777
|
-
listening: false
|
|
21778
|
-
});
|
|
21779
|
-
userPointNode$1.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21780
|
-
userPointerNode$1.add(userPointNode$1);
|
|
21781
|
-
userPointerNode$1.add(userNameBackground);
|
|
21782
|
-
userPointerNode$1.add(userNameNode);
|
|
21783
|
-
pointersLayer?.add(userPointerNode$1);
|
|
21784
|
-
continue;
|
|
21785
|
-
}
|
|
21786
|
-
const oldPos = {
|
|
21787
|
-
x: userPointer.oldPos.x,
|
|
21788
|
-
y: userPointer.oldPos.y
|
|
21789
|
-
};
|
|
21790
|
-
const actualPos = {
|
|
21907
|
+
const userPointerNode = new Konva.Group({
|
|
21908
|
+
name: "pointer",
|
|
21909
|
+
id: `pointer_${userPointer.actualPos.user}`,
|
|
21791
21910
|
x: userPointer.actualPos.x,
|
|
21792
|
-
y: userPointer.actualPos.y
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
radius: this.userPointerCircleRadius / stage.scaleX(),
|
|
21798
|
-
strokeWidth: this.userPointerCircleStrokeWidth / stage.scaleX()
|
|
21911
|
+
y: userPointer.actualPos.y,
|
|
21912
|
+
opacity: 1,
|
|
21913
|
+
listening: false,
|
|
21914
|
+
scaleX: 1 / stage.scaleX(),
|
|
21915
|
+
scaleY: 1 / stage.scaleY()
|
|
21799
21916
|
});
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21917
|
+
userPointerNode.moveToTop();
|
|
21918
|
+
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
21919
|
+
const userColor = this.stringToColor(userPointer.actualPos.user);
|
|
21920
|
+
const userContrastColor = this.getContrastTextColor(userColor);
|
|
21921
|
+
const userPointNode = new Konva.Circle({
|
|
21922
|
+
id: `pointer_${userPointer.actualPos.user}_userPoint`,
|
|
21923
|
+
x: 0,
|
|
21924
|
+
y: 0,
|
|
21925
|
+
radius: circleRadius,
|
|
21926
|
+
fill: userColor,
|
|
21927
|
+
stroke: "black",
|
|
21928
|
+
strokeWidth: circleStrokeWidth,
|
|
21929
|
+
strokeScaleEnabled: false,
|
|
21930
|
+
listening: false
|
|
21806
21931
|
});
|
|
21807
|
-
const
|
|
21808
|
-
|
|
21809
|
-
x:
|
|
21810
|
-
y: -
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21932
|
+
const userNameNode = new Konva.Text({
|
|
21933
|
+
id: `pointer_${userPointer.actualPos.user}_userPointName`,
|
|
21934
|
+
x: separation,
|
|
21935
|
+
y: -circleRadius * 2 + backgroundPaddingY,
|
|
21936
|
+
text: userPointer.actualPos.user.trim(),
|
|
21937
|
+
fontSize,
|
|
21938
|
+
fontFamily,
|
|
21939
|
+
lineHeight: .9,
|
|
21940
|
+
fill: userContrastColor,
|
|
21941
|
+
align: "center",
|
|
21942
|
+
verticalAlign: "middle",
|
|
21943
|
+
listening: false,
|
|
21944
|
+
strokeScaleEnabled: false,
|
|
21945
|
+
ellipsis: true
|
|
21814
21946
|
});
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21947
|
+
const textWidth = userNameNode.getTextWidth();
|
|
21948
|
+
const textHeight = userNameNode.getTextHeight();
|
|
21949
|
+
userNameNode.width(textWidth + backgroundPaddingX * 2);
|
|
21950
|
+
userNameNode.height(textHeight + backgroundPaddingY * 2);
|
|
21951
|
+
const userNameBackground = new Konva.Rect({
|
|
21952
|
+
id: `pointer_${userPointer.actualPos.user}_userPointRect`,
|
|
21953
|
+
x: separation,
|
|
21954
|
+
y: -backgroundPaddingY,
|
|
21955
|
+
width: textWidth + backgroundPaddingX * 2,
|
|
21956
|
+
height: textHeight + backgroundPaddingY * 2,
|
|
21957
|
+
cornerRadius: backgroundCornerRadius,
|
|
21958
|
+
fill: userColor,
|
|
21959
|
+
listening: false
|
|
21820
21960
|
});
|
|
21961
|
+
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
21962
|
+
userPointerNode.add(userPointNode);
|
|
21963
|
+
userPointerNode.add(userNameBackground);
|
|
21964
|
+
userPointerNode.add(userNameNode);
|
|
21965
|
+
pointersLayer?.add(userPointerNode);
|
|
21821
21966
|
}
|
|
21967
|
+
const selectors = pointersLayer?.find(".selector") ?? [];
|
|
21968
|
+
for (const selector of selectors) selector.moveToBottom();
|
|
21822
21969
|
}
|
|
21823
21970
|
enable() {
|
|
21824
21971
|
this.getLayer()?.show();
|
|
@@ -22224,4 +22371,4 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
|
|
|
22224
22371
|
};
|
|
22225
22372
|
|
|
22226
22373
|
//#endregion
|
|
22227
|
-
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_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, 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, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, moveNodeToContainer, resetScale };
|
|
22374
|
+
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.
|
|
3
|
+
"version": "0.16.1",
|
|
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.
|
|
46
|
+
"@inditextech/weave-types": "0.16.1",
|
|
47
47
|
"@syncedstore/core": "0.6.0",
|
|
48
48
|
"canvas": "3.1.0",
|
|
49
49
|
"konva": "9.3.20",
|