pts 0.12.0 → 0.12.1

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/dist/index.d.mts CHANGED
@@ -467,13 +467,11 @@ declare abstract class MultiTouchSpace extends Space {
467
467
  bindKeyboard(bind?: boolean): this;
468
468
  touchesToPoints(evt: TouchEvent, which?: TouchPointsKey): Pt[];
469
469
  protected _mouseAction(type: string, evt: MouseEvent | TouchEvent | PointerEvent): void;
470
- protected _mouseDown(evt: MouseEvent | TouchEvent): boolean;
471
- protected _pointerDown(evt: PointerEvent): boolean;
472
- protected _mouseUp(evt: MouseEvent | TouchEvent): boolean;
473
- protected _pointerUp(evt: PointerEvent): boolean;
474
- protected _mouseMove(evt: MouseEvent | TouchEvent): boolean;
475
- protected _mouseOver(evt: MouseEvent | TouchEvent): boolean;
476
- protected _mouseOut(evt: MouseEvent | TouchEvent): boolean;
470
+ protected _mouseDown(evt: PointerEvent): boolean;
471
+ protected _mouseUp(evt: PointerEvent): boolean;
472
+ protected _mouseMove(evt: PointerEvent): boolean;
473
+ protected _mouseOver(evt: PointerEvent): boolean;
474
+ protected _mouseOut(evt: PointerEvent): boolean;
477
475
  protected _mouseClick(evt: MouseEvent | TouchEvent): boolean;
478
476
  protected _contextMenu(evt: MouseEvent): boolean;
479
477
  protected _touchMove(evt: TouchEvent): boolean;
package/dist/index.d.ts CHANGED
@@ -467,13 +467,11 @@ declare abstract class MultiTouchSpace extends Space {
467
467
  bindKeyboard(bind?: boolean): this;
468
468
  touchesToPoints(evt: TouchEvent, which?: TouchPointsKey): Pt[];
469
469
  protected _mouseAction(type: string, evt: MouseEvent | TouchEvent | PointerEvent): void;
470
- protected _mouseDown(evt: MouseEvent | TouchEvent): boolean;
471
- protected _pointerDown(evt: PointerEvent): boolean;
472
- protected _mouseUp(evt: MouseEvent | TouchEvent): boolean;
473
- protected _pointerUp(evt: PointerEvent): boolean;
474
- protected _mouseMove(evt: MouseEvent | TouchEvent): boolean;
475
- protected _mouseOver(evt: MouseEvent | TouchEvent): boolean;
476
- protected _mouseOut(evt: MouseEvent | TouchEvent): boolean;
470
+ protected _mouseDown(evt: PointerEvent): boolean;
471
+ protected _mouseUp(evt: PointerEvent): boolean;
472
+ protected _mouseMove(evt: PointerEvent): boolean;
473
+ protected _mouseOver(evt: PointerEvent): boolean;
474
+ protected _mouseOut(evt: PointerEvent): boolean;
477
475
  protected _mouseClick(evt: MouseEvent | TouchEvent): boolean;
478
476
  protected _contextMenu(evt: MouseEvent): boolean;
479
477
  protected _touchMove(evt: TouchEvent): boolean;
package/dist/index.js CHANGED
@@ -5014,27 +5014,21 @@ var MultiTouchSpace = class extends Space {
5014
5014
  this._mouseOut = this._mouseOut.bind(this);
5015
5015
  this._mouseMove = this._mouseMove.bind(this);
5016
5016
  this._mouseClick = this._mouseClick.bind(this);
5017
- this._pointerDown = this._pointerDown.bind(this);
5018
- this._pointerUp = this._pointerUp.bind(this);
5019
5017
  this._contextMenu = this._contextMenu.bind(this);
5020
- this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
5021
- this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
5022
- this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
5023
- this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
5024
- this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
5025
- this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
5026
- this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
5018
+ this.bindCanvas("pointerdown", this._mouseDown, {}, customTarget);
5019
+ this.bindCanvas("pointerup", this._mouseUp, {}, customTarget);
5020
+ this.bindCanvas("pointerover", this._mouseOver, {}, customTarget);
5021
+ this.bindCanvas("pointerout", this._mouseOut, {}, customTarget);
5022
+ this.bindCanvas("pointermove", this._mouseMove, {}, customTarget);
5027
5023
  this.bindCanvas("click", this._mouseClick, {}, customTarget);
5028
5024
  this.bindCanvas("contextmenu", this._contextMenu, {}, customTarget);
5029
5025
  this._hasMouse = true;
5030
5026
  } else {
5031
- this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
5032
- this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
5033
- this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
5034
- this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
5035
- this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
5036
- this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
5037
- this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
5027
+ this.unbindCanvas("pointerdown", this._mouseDown, {}, customTarget);
5028
+ this.unbindCanvas("pointerup", this._mouseUp, {}, customTarget);
5029
+ this.unbindCanvas("pointerover", this._mouseOver, {}, customTarget);
5030
+ this.unbindCanvas("pointerout", this._mouseOut, {}, customTarget);
5031
+ this.unbindCanvas("pointermove", this._mouseMove, {}, customTarget);
5038
5032
  this.unbindCanvas("click", this._mouseClick, {}, customTarget);
5039
5033
  this.unbindCanvas("contextmenu", this._contextMenu, {}, customTarget);
5040
5034
  this._hasMouse = false;
@@ -5140,11 +5134,8 @@ var MultiTouchSpace = class extends Space {
5140
5134
  */
5141
5135
  _mouseDown(evt) {
5142
5136
  this._mouseAction(UIPointerActions.down, evt);
5143
- this._pressed = true;
5144
- return false;
5145
- }
5146
- _pointerDown(evt) {
5147
5137
  this._mouseAction(UIPointerActions.pointerdown, evt);
5138
+ this._pressed = true;
5148
5139
  if (evt.target instanceof Element) {
5149
5140
  evt.target.setPointerCapture(evt.pointerId);
5150
5141
  }
@@ -5155,6 +5146,7 @@ var MultiTouchSpace = class extends Space {
5155
5146
  * @param evt
5156
5147
  */
5157
5148
  _mouseUp(evt) {
5149
+ this._mouseAction(UIPointerActions.pointerup, evt);
5158
5150
  if (this._dragged) {
5159
5151
  this._mouseAction(UIPointerActions.drop, evt);
5160
5152
  } else {
@@ -5162,15 +5154,8 @@ var MultiTouchSpace = class extends Space {
5162
5154
  }
5163
5155
  this._pressed = false;
5164
5156
  this._dragged = false;
5165
- return false;
5166
- }
5167
- _pointerUp(evt) {
5168
- this._mouseAction(UIPointerActions.pointerup, evt);
5169
5157
  if (evt.target instanceof Element) {
5170
5158
  evt.target.releasePointerCapture(evt.pointerId);
5171
- if (this._dragged)
5172
- this._mouseAction(UIPointerActions.drop, evt);
5173
- this._dragged = false;
5174
5159
  }
5175
5160
  return false;
5176
5161
  }
@@ -5179,10 +5164,11 @@ var MultiTouchSpace = class extends Space {
5179
5164
  * @param evt
5180
5165
  */
5181
5166
  _mouseMove(evt) {
5182
- this._mouseAction(UIPointerActions.move, evt);
5183
5167
  if (this._pressed) {
5184
5168
  this._dragged = true;
5185
5169
  this._mouseAction(UIPointerActions.drag, evt);
5170
+ } else {
5171
+ this._mouseAction(UIPointerActions.move, evt);
5186
5172
  }
5187
5173
  return false;
5188
5174
  }
@@ -5228,7 +5214,11 @@ var MultiTouchSpace = class extends Space {
5228
5214
  * @param evt
5229
5215
  */
5230
5216
  _touchMove(evt) {
5231
- this._mouseMove(evt);
5217
+ this._mouseAction(UIPointerActions.move, evt);
5218
+ if (this._pressed) {
5219
+ this._dragged = true;
5220
+ this._mouseAction(UIPointerActions.drag, evt);
5221
+ }
5232
5222
  evt.preventDefault();
5233
5223
  return false;
5234
5224
  }
@@ -5237,7 +5227,9 @@ var MultiTouchSpace = class extends Space {
5237
5227
  * @param evt
5238
5228
  */
5239
5229
  _touchStart(evt) {
5240
- this._mouseDown(evt);
5230
+ this._mouseAction(UIPointerActions.down, evt);
5231
+ this._pressed = true;
5232
+ return false;
5241
5233
  evt.preventDefault();
5242
5234
  return false;
5243
5235
  }
package/dist/index.mjs CHANGED
@@ -4946,27 +4946,21 @@ var MultiTouchSpace = class extends Space {
4946
4946
  this._mouseOut = this._mouseOut.bind(this);
4947
4947
  this._mouseMove = this._mouseMove.bind(this);
4948
4948
  this._mouseClick = this._mouseClick.bind(this);
4949
- this._pointerDown = this._pointerDown.bind(this);
4950
- this._pointerUp = this._pointerUp.bind(this);
4951
4949
  this._contextMenu = this._contextMenu.bind(this);
4952
- this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
4953
- this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
4954
- this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
4955
- this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
4956
- this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
4957
- this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
4958
- this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
4950
+ this.bindCanvas("pointerdown", this._mouseDown, {}, customTarget);
4951
+ this.bindCanvas("pointerup", this._mouseUp, {}, customTarget);
4952
+ this.bindCanvas("pointerover", this._mouseOver, {}, customTarget);
4953
+ this.bindCanvas("pointerout", this._mouseOut, {}, customTarget);
4954
+ this.bindCanvas("pointermove", this._mouseMove, {}, customTarget);
4959
4955
  this.bindCanvas("click", this._mouseClick, {}, customTarget);
4960
4956
  this.bindCanvas("contextmenu", this._contextMenu, {}, customTarget);
4961
4957
  this._hasMouse = true;
4962
4958
  } else {
4963
- this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
4964
- this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
4965
- this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
4966
- this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
4967
- this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
4968
- this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
4969
- this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
4959
+ this.unbindCanvas("pointerdown", this._mouseDown, {}, customTarget);
4960
+ this.unbindCanvas("pointerup", this._mouseUp, {}, customTarget);
4961
+ this.unbindCanvas("pointerover", this._mouseOver, {}, customTarget);
4962
+ this.unbindCanvas("pointerout", this._mouseOut, {}, customTarget);
4963
+ this.unbindCanvas("pointermove", this._mouseMove, {}, customTarget);
4970
4964
  this.unbindCanvas("click", this._mouseClick, {}, customTarget);
4971
4965
  this.unbindCanvas("contextmenu", this._contextMenu, {}, customTarget);
4972
4966
  this._hasMouse = false;
@@ -5072,11 +5066,8 @@ var MultiTouchSpace = class extends Space {
5072
5066
  */
5073
5067
  _mouseDown(evt) {
5074
5068
  this._mouseAction(UIPointerActions.down, evt);
5075
- this._pressed = true;
5076
- return false;
5077
- }
5078
- _pointerDown(evt) {
5079
5069
  this._mouseAction(UIPointerActions.pointerdown, evt);
5070
+ this._pressed = true;
5080
5071
  if (evt.target instanceof Element) {
5081
5072
  evt.target.setPointerCapture(evt.pointerId);
5082
5073
  }
@@ -5087,6 +5078,7 @@ var MultiTouchSpace = class extends Space {
5087
5078
  * @param evt
5088
5079
  */
5089
5080
  _mouseUp(evt) {
5081
+ this._mouseAction(UIPointerActions.pointerup, evt);
5090
5082
  if (this._dragged) {
5091
5083
  this._mouseAction(UIPointerActions.drop, evt);
5092
5084
  } else {
@@ -5094,15 +5086,8 @@ var MultiTouchSpace = class extends Space {
5094
5086
  }
5095
5087
  this._pressed = false;
5096
5088
  this._dragged = false;
5097
- return false;
5098
- }
5099
- _pointerUp(evt) {
5100
- this._mouseAction(UIPointerActions.pointerup, evt);
5101
5089
  if (evt.target instanceof Element) {
5102
5090
  evt.target.releasePointerCapture(evt.pointerId);
5103
- if (this._dragged)
5104
- this._mouseAction(UIPointerActions.drop, evt);
5105
- this._dragged = false;
5106
5091
  }
5107
5092
  return false;
5108
5093
  }
@@ -5111,10 +5096,11 @@ var MultiTouchSpace = class extends Space {
5111
5096
  * @param evt
5112
5097
  */
5113
5098
  _mouseMove(evt) {
5114
- this._mouseAction(UIPointerActions.move, evt);
5115
5099
  if (this._pressed) {
5116
5100
  this._dragged = true;
5117
5101
  this._mouseAction(UIPointerActions.drag, evt);
5102
+ } else {
5103
+ this._mouseAction(UIPointerActions.move, evt);
5118
5104
  }
5119
5105
  return false;
5120
5106
  }
@@ -5160,7 +5146,11 @@ var MultiTouchSpace = class extends Space {
5160
5146
  * @param evt
5161
5147
  */
5162
5148
  _touchMove(evt) {
5163
- this._mouseMove(evt);
5149
+ this._mouseAction(UIPointerActions.move, evt);
5150
+ if (this._pressed) {
5151
+ this._dragged = true;
5152
+ this._mouseAction(UIPointerActions.drag, evt);
5153
+ }
5164
5154
  evt.preventDefault();
5165
5155
  return false;
5166
5156
  }
@@ -5169,7 +5159,9 @@ var MultiTouchSpace = class extends Space {
5169
5159
  * @param evt
5170
5160
  */
5171
5161
  _touchStart(evt) {
5172
- this._mouseDown(evt);
5162
+ this._mouseAction(UIPointerActions.down, evt);
5163
+ this._pressed = true;
5164
+ return false;
5173
5165
  evt.preventDefault();
5174
5166
  return false;
5175
5167
  }
package/dist/pts.js CHANGED
@@ -5032,27 +5032,21 @@ See https://github.com/williamngan/pts for details. */
5032
5032
  this._mouseOut = this._mouseOut.bind(this);
5033
5033
  this._mouseMove = this._mouseMove.bind(this);
5034
5034
  this._mouseClick = this._mouseClick.bind(this);
5035
- this._pointerDown = this._pointerDown.bind(this);
5036
- this._pointerUp = this._pointerUp.bind(this);
5037
5035
  this._contextMenu = this._contextMenu.bind(this);
5038
- this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
5039
- this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
5040
- this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
5041
- this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
5042
- this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
5043
- this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
5044
- this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
5036
+ this.bindCanvas("pointerdown", this._mouseDown, {}, customTarget);
5037
+ this.bindCanvas("pointerup", this._mouseUp, {}, customTarget);
5038
+ this.bindCanvas("pointerover", this._mouseOver, {}, customTarget);
5039
+ this.bindCanvas("pointerout", this._mouseOut, {}, customTarget);
5040
+ this.bindCanvas("pointermove", this._mouseMove, {}, customTarget);
5045
5041
  this.bindCanvas("click", this._mouseClick, {}, customTarget);
5046
5042
  this.bindCanvas("contextmenu", this._contextMenu, {}, customTarget);
5047
5043
  this._hasMouse = true;
5048
5044
  } else {
5049
- this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
5050
- this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
5051
- this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
5052
- this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
5053
- this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
5054
- this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
5055
- this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
5045
+ this.unbindCanvas("pointerdown", this._mouseDown, {}, customTarget);
5046
+ this.unbindCanvas("pointerup", this._mouseUp, {}, customTarget);
5047
+ this.unbindCanvas("pointerover", this._mouseOver, {}, customTarget);
5048
+ this.unbindCanvas("pointerout", this._mouseOut, {}, customTarget);
5049
+ this.unbindCanvas("pointermove", this._mouseMove, {}, customTarget);
5056
5050
  this.unbindCanvas("click", this._mouseClick, {}, customTarget);
5057
5051
  this.unbindCanvas("contextmenu", this._contextMenu, {}, customTarget);
5058
5052
  this._hasMouse = false;
@@ -5158,11 +5152,8 @@ See https://github.com/williamngan/pts for details. */
5158
5152
  */
5159
5153
  _mouseDown(evt) {
5160
5154
  this._mouseAction(UIPointerActions.down, evt);
5161
- this._pressed = true;
5162
- return false;
5163
- }
5164
- _pointerDown(evt) {
5165
5155
  this._mouseAction(UIPointerActions.pointerdown, evt);
5156
+ this._pressed = true;
5166
5157
  if (evt.target instanceof Element) {
5167
5158
  evt.target.setPointerCapture(evt.pointerId);
5168
5159
  }
@@ -5173,6 +5164,7 @@ See https://github.com/williamngan/pts for details. */
5173
5164
  * @param evt
5174
5165
  */
5175
5166
  _mouseUp(evt) {
5167
+ this._mouseAction(UIPointerActions.pointerup, evt);
5176
5168
  if (this._dragged) {
5177
5169
  this._mouseAction(UIPointerActions.drop, evt);
5178
5170
  } else {
@@ -5180,15 +5172,8 @@ See https://github.com/williamngan/pts for details. */
5180
5172
  }
5181
5173
  this._pressed = false;
5182
5174
  this._dragged = false;
5183
- return false;
5184
- }
5185
- _pointerUp(evt) {
5186
- this._mouseAction(UIPointerActions.pointerup, evt);
5187
5175
  if (evt.target instanceof Element) {
5188
5176
  evt.target.releasePointerCapture(evt.pointerId);
5189
- if (this._dragged)
5190
- this._mouseAction(UIPointerActions.drop, evt);
5191
- this._dragged = false;
5192
5177
  }
5193
5178
  return false;
5194
5179
  }
@@ -5197,10 +5182,11 @@ See https://github.com/williamngan/pts for details. */
5197
5182
  * @param evt
5198
5183
  */
5199
5184
  _mouseMove(evt) {
5200
- this._mouseAction(UIPointerActions.move, evt);
5201
5185
  if (this._pressed) {
5202
5186
  this._dragged = true;
5203
5187
  this._mouseAction(UIPointerActions.drag, evt);
5188
+ } else {
5189
+ this._mouseAction(UIPointerActions.move, evt);
5204
5190
  }
5205
5191
  return false;
5206
5192
  }
@@ -5246,7 +5232,11 @@ See https://github.com/williamngan/pts for details. */
5246
5232
  * @param evt
5247
5233
  */
5248
5234
  _touchMove(evt) {
5249
- this._mouseMove(evt);
5235
+ this._mouseAction(UIPointerActions.move, evt);
5236
+ if (this._pressed) {
5237
+ this._dragged = true;
5238
+ this._mouseAction(UIPointerActions.drag, evt);
5239
+ }
5250
5240
  evt.preventDefault();
5251
5241
  return false;
5252
5242
  }
@@ -5255,7 +5245,9 @@ See https://github.com/williamngan/pts for details. */
5255
5245
  * @param evt
5256
5246
  */
5257
5247
  _touchStart(evt) {
5258
- this._mouseDown(evt);
5248
+ this._mouseAction(UIPointerActions.down, evt);
5249
+ this._pressed = true;
5250
+ return false;
5259
5251
  evt.preventDefault();
5260
5252
  return false;
5261
5253
  }