@processmaker/modeler 1.43.4 → 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.4",
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
@@ -1895,6 +1927,34 @@ export default {
1895
1927
  this.assetFail = true;
1896
1928
  });
1897
1929
  },
1930
+ highlightTaskArrays(data) {
1931
+ if (data) {
1932
+ this.addAiHighlights(data.tasks);
1933
+ this.addAiHighlights(data.serviceTasks);
1934
+ this.addAiHighlights(data.scriptTasks);
1935
+ }
1936
+ },
1937
+ unhighlightTaskArrays(data) {
1938
+ if (data) {
1939
+ this.removeAiHighlights(data.tasks);
1940
+ this.removeAiHighlights(data.serviceTasks);
1941
+ this.removeAiHighlights(data.scriptTasks);
1942
+ }
1943
+ },
1944
+ addAiHighlights(taskArray) {
1945
+ let self = this;
1946
+ taskArray.forEach(task => {
1947
+ const taskNode = self.getElementByNodeId(task.id);
1948
+ taskNode.component.setAiStatusHighlight(task.status);
1949
+ });
1950
+ },
1951
+ removeAiHighlights(taskArray) {
1952
+ let self = this;
1953
+ taskArray.forEach(task => {
1954
+ const taskNode = self.getElementByNodeId(task.id);
1955
+ taskNode.component.unsetHighlights();
1956
+ });
1957
+ },
1898
1958
  subscribeToProgress() {
1899
1959
  const channel = `ProcessMaker.Models.User.${window.ProcessMaker?.modeler?.process?.user_id}`;
1900
1960
  const streamProgressEvent = '.ProcessMaker\\Package\\PackageAi\\Events\\GenerateArtifactsProgressEvent';
@@ -1902,17 +1962,19 @@ export default {
1902
1962
  streamProgressEvent,
1903
1963
  (response) => {
1904
1964
  if (response.data.promptSessionId !== this.promptSessionId) {
1965
+ this.unhighlightTaskArrays(response.data);
1905
1966
  return;
1906
1967
  }
1907
1968
 
1908
1969
  if (this.cancelledJobs.some((element) => element === response.data.nonce)) {
1970
+ this.unhighlightTaskArrays(response.data);
1909
1971
  return;
1910
1972
  }
1911
1973
 
1912
1974
  if (response.data) {
1913
1975
  if (response.data.progress.status === 'running') {
1914
1976
  this.loadingAI = true;
1915
- // Blue color for nodes running
1977
+ this.highlightTaskArrays(response.data);
1916
1978
  } else if (response.data.progress.status === 'error') {
1917
1979
  this.loadingAI = false;
1918
1980
  window.ProcessMaker.alert(response.data.message, 'danger');
@@ -1922,6 +1984,7 @@ export default {
1922
1984
  this.setPromptSessions(response.data.promptSessionId);
1923
1985
  // Successful generation
1924
1986
  this.assetsCreated = true;
1987
+ this.unhighlightTaskArrays(response.data);
1925
1988
  this.fetchHistory();
1926
1989
  setTimeout(() => {
1927
1990
  this.loadingAI = false;
@@ -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>
@@ -143,7 +143,29 @@ export default {
143
143
  } else {
144
144
  this.shapeView.unhighlight(this.shapeBody, this.prepareCustomColorHighlighter(color));
145
145
  }
146
-
146
+ },
147
+ setAiStatusHighlight(status) {
148
+ this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
149
+ if (status === 'generated') {
150
+ this.shape.attr('body/fill', COLOR_COMPLETED_FILL);
151
+ this.shapeView.highlight(this.shapeBody, completedHighlighter);
152
+ }
153
+ this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
154
+ if (status === 'generating') {
155
+ this.shape.attr('body/fill', COLOR_IN_PROGRESS_FILL);
156
+ this.shapeView.highlight(this.shapeBody, inProgressHighlighter);
157
+ }
158
+ this.shapeView.unhighlight(this.shapeBody, idleHighlighter);
159
+ if (status === 'previously generated') {
160
+ this.shape.attr('body/fill', COLOR_IDLE_FILL);
161
+ this.shapeView.highlight(this.shapeBody, idleHighlighter);
162
+ }
163
+ },
164
+ unsetHighlights() {
165
+ this.shape.attr('body/fill', '#FFFFFF');
166
+ this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
167
+ this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
168
+ this.shapeView.unhighlight(this.shapeBody, idleHighlighter);
147
169
  },
148
170
  setShapeHighlightForReadOnly() {
149
171
  if (!this.shapeView) {
@@ -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
  });