@processmaker/modeler 1.43.5 → 1.43.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.43.5",
3
+ "version": "1.43.6",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -195,7 +195,7 @@
195
195
  <RemoteCursor
196
196
  v-for="player in filteredPlayers"
197
197
  :key="player.id"
198
- :data="player"
198
+ :data="prepareCursorData(player)"
199
199
  />
200
200
  </b-row>
201
201
  </span>
@@ -1665,7 +1665,19 @@ export default {
1665
1665
  },
1666
1666
  pointerMoveHandler(event) {
1667
1667
  const { clientX: x, clientY: y } = event;
1668
- window.ProcessMaker.EventBus.$emit('multiplayer-updateMousePosition', { top: y, left: x });
1668
+ const { paper } = this.paperManager;
1669
+ let updateMousePosition = _.debounce(function() {
1670
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateMousePosition', {
1671
+ coordinates: {
1672
+ clientX: x,
1673
+ clientY: y,
1674
+ },
1675
+ paperTranslate: paper.translate(), // add papper translate
1676
+ paperScale: paper.scale(), // add scale
1677
+ });
1678
+ }, 3000000, { leading: true, trailing: true });
1679
+ updateMousePosition();
1680
+
1669
1681
  if (store.getters.isReadOnly) {
1670
1682
  if (this.canvasDragPosition && !this.clientLeftPaper) {
1671
1683
  this.paperManager.translate(
@@ -1733,6 +1745,26 @@ export default {
1733
1745
  this.players = this.players.map((item) => (item.id === data.id ? { ...item, ...data } : item));
1734
1746
  }
1735
1747
  },
1748
+ /**
1749
+ * Prepare cursor data taking into account, paper translate and paper scale
1750
+ * @param {Object} player
1751
+ * @return {Object}
1752
+ */
1753
+ prepareCursorData(player) {
1754
+ const { paper } = this.paperManager;
1755
+ const localTranslate = paper.translate();
1756
+ // calculate paper translated deltas
1757
+ let deltaX = localTranslate.tx - player.cursor.paperTranslate.tx/player.cursor.paperScale.sx;
1758
+ let deltaY = localTranslate.ty - player.cursor.paperTranslate.ty/player.cursor.paperScale.sy;
1759
+ // get new cursor coordinates taking into consideration paper scale and paper translated
1760
+ const left = player.cursor.coordinates.clientX/player.cursor.paperScale.sx + deltaX;
1761
+ const top = player.cursor.coordinates.clientY/player.cursor.paperScale.sy + deltaY;
1762
+ return {
1763
+ cursor: { left, top },
1764
+ color: player.color,
1765
+ name: player.name,
1766
+ };
1767
+ },
1736
1768
  /**
1737
1769
  * Unhightligt selected Nodes
1738
1770
  * @param {String} clientId
@@ -41,20 +41,21 @@ export default {
41
41
  }
42
42
 
43
43
  &-username {
44
+ position: absolute;
44
45
  display: flex;
45
46
  justify-content: center;
46
47
  align-items: center;
47
- margin-top: 12px;
48
+ margin: 17px 0 0 17px;
48
49
  padding: 4px 10px;
49
50
  gap: 10px;
50
51
  border-radius: 4px;
51
52
  background-color: #212529;
52
-
53
53
  color: #FFFFFF;
54
54
  font-size: 12px;
55
55
  font-style: normal;
56
56
  font-weight: 400;
57
57
  line-height: normal;
58
+ min-width: 100px;
58
59
  }
59
60
  }
60
61
  </style>
@@ -55,8 +55,12 @@ export default class Multiplayer {
55
55
  clientAvatar: window.ProcessMaker.user?.avatar,
56
56
  clientColor: window.ProcessMaker.user?.color || this.colorUtil.randomColor(window.ProcessMaker.user?.fullName),
57
57
  clientCursor: {
58
- top: 300,
59
- left: 300,
58
+ coordinates: {
59
+ clientX: 300,
60
+ clientY: 300,
61
+ },
62
+ paperTranslate: this.modeler.paper.translate(),
63
+ paperScale: this.modeler.paper.scale(),
60
64
  },
61
65
  });
62
66
  });