pxt-arcade 2.0.49 → 2.0.51

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.
@@ -356,6 +356,10 @@ declare namespace pxsim.browserEvents {
356
356
  interface BrowserEventsBoard extends CommonBoard {
357
357
  mouseState: MouseState;
358
358
  }
359
+ const INTERNAL_KEY_DOWN = 6870;
360
+ const INTERNAL_KEY_UP = 6871;
361
+ const INTERNAL_POINTER_DOWN = 6868;
362
+ const INTERNAL_POINTER_UP = 6869;
359
363
  type MouseEvent = "pointerdown" | "pointerup" | "pointermove" | "pointerleave" | "pointerenter" | "pointercancel" | "pointerover" | "pointerout";
360
364
  class MouseState {
361
365
  protected x: number;
@@ -843,10 +843,10 @@ var pxsim;
843
843
  browserEvents.onKeyboardEvent = onKeyboardEvent;
844
844
  function fireEvent(key, pressed) {
845
845
  if (pressed) {
846
- pxsim.board().bus.queue(6866, key);
846
+ pxsim.board().bus.queue(browserEvents.INTERNAL_KEY_DOWN, key);
847
847
  }
848
848
  else {
849
- pxsim.board().bus.queue(6867, key);
849
+ pxsim.board().bus.queue(browserEvents.INTERNAL_KEY_UP, key);
850
850
  }
851
851
  }
852
852
  function getValueForKey(event) {
@@ -1040,6 +1040,10 @@ var pxsim;
1040
1040
  var browserEvents;
1041
1041
  (function (browserEvents) {
1042
1042
  const THROTTLE_INTERVAL = 50;
1043
+ browserEvents.INTERNAL_KEY_DOWN = 6870;
1044
+ browserEvents.INTERNAL_KEY_UP = 6871;
1045
+ browserEvents.INTERNAL_POINTER_DOWN = 6868;
1046
+ browserEvents.INTERNAL_POINTER_UP = 6869;
1043
1047
  class MouseState {
1044
1048
  constructor() {
1045
1049
  this.onMove = pxsim.U.throttle(() => {
@@ -1062,9 +1066,16 @@ var pxsim;
1062
1066
  "pointerover",
1063
1067
  "pointerout",
1064
1068
  ];
1069
+ let eventId = 6857 + events.indexOf(event.type);
1070
+ if (event.type === "pointerdown") {
1071
+ eventId = browserEvents.INTERNAL_POINTER_DOWN;
1072
+ }
1073
+ else if (event.type === "pointerup") {
1074
+ eventId = browserEvents.INTERNAL_POINTER_UP;
1075
+ }
1065
1076
  // We add 1 to the button here because the left button is 0 and
1066
1077
  // that's used as a wildcard in our event bus
1067
- pxsim.board().bus.queue(6857 + events.indexOf(event.type), (event.button || 0) + 1);
1078
+ pxsim.board().bus.queue(eventId, (event.button || 0) + 1);
1068
1079
  }
1069
1080
  onWheelEvent(dx, dy, dz) {
1070
1081
  this.dx = dx;
package/built/sim.js CHANGED
@@ -4599,10 +4599,10 @@ var pxsim;
4599
4599
  browserEvents.onKeyboardEvent = onKeyboardEvent;
4600
4600
  function fireEvent(key, pressed) {
4601
4601
  if (pressed) {
4602
- pxsim.board().bus.queue(6866, key);
4602
+ pxsim.board().bus.queue(browserEvents.INTERNAL_KEY_DOWN, key);
4603
4603
  }
4604
4604
  else {
4605
- pxsim.board().bus.queue(6867, key);
4605
+ pxsim.board().bus.queue(browserEvents.INTERNAL_KEY_UP, key);
4606
4606
  }
4607
4607
  }
4608
4608
  function getValueForKey(event) {
@@ -4796,6 +4796,10 @@ var pxsim;
4796
4796
  var browserEvents;
4797
4797
  (function (browserEvents) {
4798
4798
  const THROTTLE_INTERVAL = 50;
4799
+ browserEvents.INTERNAL_KEY_DOWN = 6870;
4800
+ browserEvents.INTERNAL_KEY_UP = 6871;
4801
+ browserEvents.INTERNAL_POINTER_DOWN = 6868;
4802
+ browserEvents.INTERNAL_POINTER_UP = 6869;
4799
4803
  class MouseState {
4800
4804
  constructor() {
4801
4805
  this.onMove = pxsim.U.throttle(() => {
@@ -4818,9 +4822,16 @@ var pxsim;
4818
4822
  "pointerover",
4819
4823
  "pointerout",
4820
4824
  ];
4825
+ let eventId = 6857 + events.indexOf(event.type);
4826
+ if (event.type === "pointerdown") {
4827
+ eventId = browserEvents.INTERNAL_POINTER_DOWN;
4828
+ }
4829
+ else if (event.type === "pointerup") {
4830
+ eventId = browserEvents.INTERNAL_POINTER_UP;
4831
+ }
4821
4832
  // We add 1 to the button here because the left button is 0 and
4822
4833
  // that's used as a wildcard in our event bus
4823
- pxsim.board().bus.queue(6857 + events.indexOf(event.type), (event.button || 0) + 1);
4834
+ pxsim.board().bus.queue(eventId, (event.button || 0) + 1);
4824
4835
  }
4825
4836
  onWheelEvent(dx, dy, dz) {
4826
4837
  this.dx = dx;