plottable 3.9.0-dev-84-g91917c41 → 3.9.0-dev-85-gaa88eb88

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.
@@ -10,4 +10,4 @@ exports.version = void 0;
10
10
  * real version number during the dist phase for for npm module publishing. Modifying this line should
11
11
  * be accompanied by modifying the "sed-version" task in package.json accordingly.
12
12
  */
13
- exports.version = "3.9.0-dev-84-g91917c41";
13
+ exports.version = "3.9.0-dev-85-gaa88eb88";
@@ -78,7 +78,14 @@ var Dispatcher = /** @class */ (function () {
78
78
  }
79
79
  var callbackSet = this._eventNameToCallbackSet[eventName];
80
80
  if (callbackSet != null) {
81
- callbackSet.callCallbacks.apply(callbackSet, args);
81
+ // Interactions can resubscribe while handling an event, which Set.forEach would visit again
82
+ var callbacks_1 = [];
83
+ callbackSet.forEach(function (callback) { return callbacks_1.push(callback); });
84
+ callbacks_1.forEach(function (callback) {
85
+ if (callbackSet.has(callback)) {
86
+ callback.apply(callbackSet, args);
87
+ }
88
+ });
82
89
  }
83
90
  };
84
91
  return Dispatcher;
@@ -41,7 +41,14 @@ var Click = /** @class */ (function (_super) {
41
41
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
42
42
  };
43
43
  Click.prototype._unanchor = function () {
44
+ var _this = this;
44
45
  _super.prototype._unanchor.call(this);
46
+ // Preserve a press through synchronous renderTo(), but discard it if its release can be missed.
47
+ Promise.resolve().then(function () {
48
+ if (!_this._isAnchored) {
49
+ _this._clickedDown = false;
50
+ }
51
+ });
45
52
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
46
53
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
47
54
  this._mouseDispatcher.offDblClick(this._dblClickCallback);
@@ -45,7 +45,13 @@ var Drag = /** @class */ (function (_super) {
45
45
  this._touchDispatcher.onTouchEnd(this._touchEndCallback);
46
46
  };
47
47
  Drag.prototype._unanchor = function () {
48
+ var _this = this;
48
49
  _super.prototype._unanchor.call(this);
50
+ Promise.resolve().then(function () {
51
+ if (!_this._isAnchored) {
52
+ _this._dragging = false;
53
+ }
54
+ });
49
55
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
50
56
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
51
57
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
@@ -6,7 +6,8 @@ import { Component } from "../components/component";
6
6
  import { Point } from "../core/interfaces";
7
7
  export declare class Interaction {
8
8
  private _anchorCallback;
9
- private _isAnchored;
9
+ private _detachCallback;
10
+ protected _isAnchored: boolean;
10
11
  private _enabled;
11
12
  protected _componentAttachedTo: Component;
12
13
  /**
@@ -8,7 +8,15 @@ exports.Interaction = void 0;
8
8
  var Interaction = /** @class */ (function () {
9
9
  function Interaction() {
10
10
  var _this = this;
11
- this._anchorCallback = function (component) { return _this._anchor(component); };
11
+ this._anchorCallback = function (component) {
12
+ _this._detachCallback();
13
+ _this._anchor(component);
14
+ };
15
+ this._detachCallback = function () {
16
+ if (_this._isAnchored) {
17
+ _this._unanchor();
18
+ }
19
+ };
12
20
  this._enabled = true;
13
21
  }
14
22
  /**
@@ -87,6 +95,7 @@ var Interaction = /** @class */ (function () {
87
95
  Interaction.prototype._connect = function () {
88
96
  if (this.enabled() && this._componentAttachedTo != null && !this._isAnchored) {
89
97
  this._componentAttachedTo.onAnchor(this._anchorCallback);
98
+ this._componentAttachedTo.onDetach(this._detachCallback);
90
99
  }
91
100
  };
92
101
  Interaction.prototype._disconnect = function () {
@@ -95,6 +104,7 @@ var Interaction = /** @class */ (function () {
95
104
  }
96
105
  if (this._componentAttachedTo != null) {
97
106
  this._componentAttachedTo.offAnchor(this._anchorCallback);
107
+ this._componentAttachedTo.offDetach(this._detachCallback);
98
108
  }
99
109
  };
100
110
  return Interaction;
@@ -30,7 +30,14 @@ var Key = /** @class */ (function (_super) {
30
30
  this._keyDispatcher.onKeyUp(this._keyUpCallback);
31
31
  };
32
32
  Key.prototype._unanchor = function () {
33
+ var _this = this;
33
34
  _super.prototype._unanchor.call(this);
35
+ // Preserve held keys through synchronous renderTo(), but discard them if keyup can be missed.
36
+ Promise.resolve().then(function () {
37
+ if (!_this._isAnchored) {
38
+ _this._downedKeys = new Utils.Set();
39
+ }
40
+ });
34
41
  this._positionDispatcher.offMouseMove(this._mouseMoveCallback);
35
42
  this._positionDispatcher = null;
36
43
  this._keyDispatcher.offKeyDown(this._keyDownCallback);
@@ -140,7 +140,13 @@ var PanZoom = /** @class */ (function (_super) {
140
140
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
141
141
  };
142
142
  PanZoom.prototype._unanchor = function () {
143
+ var _this = this;
143
144
  _super.prototype._unanchor.call(this);
145
+ Promise.resolve().then(function () {
146
+ if (!_this._isAnchored) {
147
+ _this._touchIds.clear();
148
+ }
149
+ });
144
150
  this._mouseDispatcher.offWheel(this._wheelCallback);
145
151
  this._mouseDispatcher = null;
146
152
  this._touchDispatcher.offTouchStart(this._touchStartCallback);
@@ -29,7 +29,14 @@ var Pointer = /** @class */ (function (_super) {
29
29
  this._touchDispatcher.onTouchStart(this._touchStartCallback);
30
30
  };
31
31
  Pointer.prototype._unanchor = function () {
32
+ var _this = this;
32
33
  _super.prototype._unanchor.call(this);
34
+ // Preserve hover through synchronous renderTo(), but discard state if pointer events can be missed.
35
+ Promise.resolve().then(function () {
36
+ if (!_this._isAnchored) {
37
+ _this._overComponent = false;
38
+ }
39
+ });
33
40
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
34
41
  this._mouseDispatcher = null;
35
42
  this._touchDispatcher.offTouchStart(this._touchStartCallback);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "plottable",
3
3
  "description": "A modular charting library built on D3",
4
- "version": "3.9.0-dev-84-g91917c41",
4
+ "version": "3.9.0-dev-85-gaa88eb88",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/plottable.js CHANGED
@@ -2735,7 +2735,15 @@ exports.Interaction = void 0;
2735
2735
  var Interaction = /** @class */ (function () {
2736
2736
  function Interaction() {
2737
2737
  var _this = this;
2738
- this._anchorCallback = function (component) { return _this._anchor(component); };
2738
+ this._anchorCallback = function (component) {
2739
+ _this._detachCallback();
2740
+ _this._anchor(component);
2741
+ };
2742
+ this._detachCallback = function () {
2743
+ if (_this._isAnchored) {
2744
+ _this._unanchor();
2745
+ }
2746
+ };
2739
2747
  this._enabled = true;
2740
2748
  }
2741
2749
  /**
@@ -2814,6 +2822,7 @@ var Interaction = /** @class */ (function () {
2814
2822
  Interaction.prototype._connect = function () {
2815
2823
  if (this.enabled() && this._componentAttachedTo != null && !this._isAnchored) {
2816
2824
  this._componentAttachedTo.onAnchor(this._anchorCallback);
2825
+ this._componentAttachedTo.onDetach(this._detachCallback);
2817
2826
  }
2818
2827
  };
2819
2828
  Interaction.prototype._disconnect = function () {
@@ -2822,6 +2831,7 @@ var Interaction = /** @class */ (function () {
2822
2831
  }
2823
2832
  if (this._componentAttachedTo != null) {
2824
2833
  this._componentAttachedTo.offAnchor(this._anchorCallback);
2834
+ this._componentAttachedTo.offDetach(this._detachCallback);
2825
2835
  }
2826
2836
  };
2827
2837
  return Interaction;
@@ -4490,7 +4500,14 @@ var Dispatcher = /** @class */ (function () {
4490
4500
  }
4491
4501
  var callbackSet = this._eventNameToCallbackSet[eventName];
4492
4502
  if (callbackSet != null) {
4493
- callbackSet.callCallbacks.apply(callbackSet, args);
4503
+ // Interactions can resubscribe while handling an event, which Set.forEach would visit again
4504
+ var callbacks_1 = [];
4505
+ callbackSet.forEach(function (callback) { return callbacks_1.push(callback); });
4506
+ callbacks_1.forEach(function (callback) {
4507
+ if (callbackSet.has(callback)) {
4508
+ callback.apply(callbackSet, args);
4509
+ }
4510
+ });
4494
4511
  }
4495
4512
  };
4496
4513
  return Dispatcher;
@@ -7286,7 +7303,14 @@ var Key = /** @class */ (function (_super) {
7286
7303
  this._keyDispatcher.onKeyUp(this._keyUpCallback);
7287
7304
  };
7288
7305
  Key.prototype._unanchor = function () {
7306
+ var _this = this;
7289
7307
  _super.prototype._unanchor.call(this);
7308
+ // Preserve held keys through synchronous renderTo(), but discard them if keyup can be missed.
7309
+ Promise.resolve().then(function () {
7310
+ if (!_this._isAnchored) {
7311
+ _this._downedKeys = new Utils.Set();
7312
+ }
7313
+ });
7290
7314
  this._positionDispatcher.offMouseMove(this._mouseMoveCallback);
7291
7315
  this._positionDispatcher = null;
7292
7316
  this._keyDispatcher.offKeyDown(this._keyDownCallback);
@@ -14887,7 +14911,14 @@ var Click = /** @class */ (function (_super) {
14887
14911
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
14888
14912
  };
14889
14913
  Click.prototype._unanchor = function () {
14914
+ var _this = this;
14890
14915
  _super.prototype._unanchor.call(this);
14916
+ // Preserve a press through synchronous renderTo(), but discard it if its release can be missed.
14917
+ Promise.resolve().then(function () {
14918
+ if (!_this._isAnchored) {
14919
+ _this._clickedDown = false;
14920
+ }
14921
+ });
14891
14922
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
14892
14923
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
14893
14924
  this._mouseDispatcher.offDblClick(this._dblClickCallback);
@@ -15023,7 +15054,13 @@ var Drag = /** @class */ (function (_super) {
15023
15054
  this._touchDispatcher.onTouchEnd(this._touchEndCallback);
15024
15055
  };
15025
15056
  Drag.prototype._unanchor = function () {
15057
+ var _this = this;
15026
15058
  _super.prototype._unanchor.call(this);
15059
+ Promise.resolve().then(function () {
15060
+ if (!_this._isAnchored) {
15061
+ _this._dragging = false;
15062
+ }
15063
+ });
15027
15064
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
15028
15065
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
15029
15066
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
@@ -15296,7 +15333,13 @@ var PanZoom = /** @class */ (function (_super) {
15296
15333
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
15297
15334
  };
15298
15335
  PanZoom.prototype._unanchor = function () {
15336
+ var _this = this;
15299
15337
  _super.prototype._unanchor.call(this);
15338
+ Promise.resolve().then(function () {
15339
+ if (!_this._isAnchored) {
15340
+ _this._touchIds.clear();
15341
+ }
15342
+ });
15300
15343
  this._mouseDispatcher.offWheel(this._wheelCallback);
15301
15344
  this._mouseDispatcher = null;
15302
15345
  this._touchDispatcher.offTouchStart(this._touchStartCallback);
@@ -15669,7 +15712,14 @@ var Pointer = /** @class */ (function (_super) {
15669
15712
  this._touchDispatcher.onTouchStart(this._touchStartCallback);
15670
15713
  };
15671
15714
  Pointer.prototype._unanchor = function () {
15715
+ var _this = this;
15672
15716
  _super.prototype._unanchor.call(this);
15717
+ // Preserve hover through synchronous renderTo(), but discard state if pointer events can be missed.
15718
+ Promise.resolve().then(function () {
15719
+ if (!_this._isAnchored) {
15720
+ _this._overComponent = false;
15721
+ }
15722
+ });
15673
15723
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
15674
15724
  this._mouseDispatcher = null;
15675
15725
  this._touchDispatcher.offTouchStart(this._touchStartCallback);