@joint/core 4.2.3 → 4.2.4

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/src/dia/Graph.mjs CHANGED
@@ -147,7 +147,7 @@ export const Graph = Model.extend({
147
147
 
148
148
  } while (sortedCells.length > 0);
149
149
 
150
- this.stopBatch('clear');
150
+ this.stopBatch('clear', opt);
151
151
 
152
152
  return this;
153
153
  },
@@ -329,7 +329,7 @@ export const Graph = Model.extend({
329
329
  removeCells: function(cellRefs, options) {
330
330
  if (!cellRefs.length) return this;
331
331
  // Remove multiple cells in a single batch
332
- this.startBatch('remove');
332
+ this.startBatch('remove', options);
333
333
  for (const cellRef of cellRefs) {
334
334
  if (!cellRef) continue;
335
335
  let cell;
@@ -344,7 +344,7 @@ export const Graph = Model.extend({
344
344
  }
345
345
  this.layerCollection.removeCell(cell, options);
346
346
  }
347
- this.stopBatch('remove');
347
+ this.stopBatch('remove', options);
348
348
  return this;
349
349
  },
350
350
 
@@ -376,7 +376,7 @@ export const Graph = Model.extend({
376
376
 
377
377
  // 3. Add the replacement cell
378
378
  this.addCell(replacement, replaceOptions);
379
- this.stopBatch(batchName);
379
+ this.stopBatch(batchName, opt);
380
380
  },
381
381
 
382
382
  /**
@@ -472,7 +472,7 @@ export const Graph = Model.extend({
472
472
  }
473
473
  }
474
474
 
475
- this.stopBatch(batchName);
475
+ this.stopBatch(batchName, opt);
476
476
  },
477
477
 
478
478
  /**
@@ -499,27 +499,27 @@ export const Graph = Model.extend({
499
499
  throw new Error('dia.Graph: cell to remove does not exist in the graph.');
500
500
  }
501
501
  if (cell.graph !== this) return;
502
- this.startBatch('remove');
502
+ this.startBatch('remove', options);
503
503
  cell.collection.remove(cell, options);
504
- this.stopBatch('remove');
504
+ this.stopBatch('remove', options);
505
505
  },
506
506
 
507
507
  transferCellEmbeds: function(sourceCell, targetCell, opt = {}) {
508
508
 
509
509
  const batchName = 'transfer-embeds';
510
- this.startBatch(batchName);
510
+ this.startBatch(batchName, opt);
511
511
 
512
512
  // Embed children of the source cell in the target cell.
513
513
  const children = sourceCell.getEmbeddedCells();
514
514
  targetCell.embed(children, { ...opt, reparent: true });
515
515
 
516
- this.stopBatch(batchName);
516
+ this.stopBatch(batchName, opt);
517
517
  },
518
518
 
519
519
  transferCellConnectedLinks: function(sourceCell, targetCell, opt = {}) {
520
520
 
521
521
  const batchName = 'transfer-connected-links';
522
- this.startBatch(batchName);
522
+ this.startBatch(batchName, opt);
523
523
 
524
524
  // Reconnect all the links connected to the old cell to the new cell.
525
525
  const connectedLinks = this.getConnectedLinks(sourceCell, opt);
@@ -534,7 +534,7 @@ export const Graph = Model.extend({
534
534
  }
535
535
  });
536
536
 
537
- this.stopBatch(batchName);
537
+ this.stopBatch(batchName, opt);
538
538
  },
539
539
 
540
540
  /**
package/src/dia/Paper.mjs CHANGED
@@ -3507,7 +3507,8 @@ export const Paper = View.extend({
3507
3507
  if (view) {
3508
3508
  // The view could have been disposed during dragging
3509
3509
  // e.g. dragged outside of the viewport and hidden
3510
- view = this.findViewByModel(view.model);
3510
+ // The model can be removed in previous mousemove event handlers
3511
+ view = this.findViewByModel(view.model) || view;
3511
3512
  view.pointermove(evt, localPoint.x, localPoint.y);
3512
3513
  } else {
3513
3514
  this.trigger('blank:pointermove', evt, localPoint.x, localPoint.y);
@@ -3528,7 +3529,8 @@ export const Paper = View.extend({
3528
3529
  if (view) {
3529
3530
  // The view could have been disposed during dragging
3530
3531
  // e.g. dragged outside of the viewport and hidden
3531
- view = this.findViewByModel(view.model);
3532
+ // The model can be removed in previous mouseup event handlers (e.g. when deleting an element after dragging)
3533
+ view = this.findViewByModel(view.model) || view;
3532
3534
  view.pointerup(normalizedEvt, localPoint.x, localPoint.y);
3533
3535
  } else {
3534
3536
  this.trigger('blank:pointerup', normalizedEvt, localPoint.x, localPoint.y);
package/src/mvc/Model.mjs CHANGED
@@ -132,7 +132,9 @@ assign(Model.prototype, Events, {
132
132
  if (this.idAttribute in attrs) {
133
133
  var prevId = this.id;
134
134
  this.id = this.get(this.idAttribute);
135
- this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
135
+ if (this.id !== prevId) {
136
+ this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
137
+ }
136
138
  }
137
139
 
138
140
  // Trigger all relevant attribute changes.