@processmaker/modeler 1.38.2 → 1.38.3

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.38.2",
3
+ "version": "1.38.3",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -26,6 +26,7 @@ export default {
26
26
  sourceShape: null,
27
27
  target: null,
28
28
  listeningToMouseup: false,
29
+ listeningToMouseleave: false,
29
30
  vertices: null,
30
31
  anchorPointFunction: getDefaultAnchorPoint,
31
32
  };
@@ -139,11 +140,13 @@ export default {
139
140
  resetShapeColor(targetShape);
140
141
 
141
142
  this.shape.on('change:vertices', this.onChangeVertices);
142
- this.shape.on('change:source', this.onChangeVertices);
143
- this.shape.on('change:target', this.onChangeVertices);
143
+ this.shape.on('change:source', this.onChangeTargets);
144
+ this.shape.on('change:target', this.onChangeTargets);
144
145
  this.shape.listenTo(this.sourceShape, 'change:position', this.updateWaypoints);
145
146
  this.shape.listenTo(targetShape, 'change:position', this.updateWaypoints);
146
147
 
148
+ this.shape.listenTo(this.paper, 'link:mouseleave', this.storeWaypoints);
149
+
147
150
  const sourceShape = this.shape.getSourceElement();
148
151
  sourceShape.embed(this.shape);
149
152
  this.$emit('set-shape-stacking', sourceShape);
@@ -155,17 +158,33 @@ export default {
155
158
  resolve();
156
159
  });
157
160
  },
161
+ async storeWaypoints() {
162
+ if (this.highlighted && !this.listeningToMouseleave) {
163
+ this.updateWaypoints();
164
+ await this.$nextTick();
165
+
166
+ this.listeningToMouseleave = true;
167
+ this.$emit('save-state');
168
+ }
169
+ },
158
170
  /**
159
171
  * On Change vertices handler
160
172
  * @param {Object} link
161
173
  * @param {Array} vertices
162
174
  * @param {Object} options
163
175
  */
164
- async onChangeVertices(link, vertices, options){
176
+ async onChangeTargets(link, vertices, options){
165
177
  if (options && options.ui) {
166
178
  await this.$nextTick();
167
179
  await this.waitForUpdateWaypoints();
180
+ await this.storeWaypoints();
181
+ }
182
+ },
183
+ async onChangeVertices(link, vertices, options){
184
+ if (options && options.ui) {
185
+ this.updateWaypoints();
168
186
  await this.$nextTick();
187
+ this.listeningToMouseleave = false;
169
188
  this.$emit('save-state');
170
189
  }
171
190
  },