pxt-core 12.3.4 → 12.3.5

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/built/pxt.js CHANGED
@@ -159234,9 +159234,16 @@ var pxsim;
159234
159234
  function setListenerPosition(x, y, z) {
159235
159235
  const ctx = context();
159236
159236
  if (ctx) {
159237
- ctx.listener.positionX.setTargetAtTime(x, 0, 0.02);
159238
- ctx.listener.positionY.setTargetAtTime(y, 0, 0.02);
159239
- ctx.listener.positionZ.setTargetAtTime(z, 0, 0.02);
159237
+ // Firefox does not support AudioParam-based positionX/Y/Z on AudioListener.
159238
+ // Fall back to the deprecated setPosition() method.
159239
+ if (ctx.listener.positionX) {
159240
+ ctx.listener.positionX.setTargetAtTime(x, 0, 0.02);
159241
+ ctx.listener.positionY.setTargetAtTime(y, 0, 0.02);
159242
+ ctx.listener.positionZ.setTargetAtTime(z, 0, 0.02);
159243
+ }
159244
+ else {
159245
+ ctx.listener.setPosition(x, y, z);
159246
+ }
159240
159247
  }
159241
159248
  }
159242
159249
  AudioContextManager.setListenerPosition = setListenerPosition;
@@ -161373,13 +161380,11 @@ var pxsim;
161373
161380
  this.panner = new PannerNode(context, {
161374
161381
  panningModel: 'HRTF',
161375
161382
  distanceModel: "linear",
161376
- positionX: 0,
161377
- positionY: 0,
161378
- positionZ: 0,
161379
- orientationX: 0,
161380
- orientationY: 0,
161381
- orientationZ: -1,
161382
161383
  });
161384
+ // Set initial position/orientation using the compat helpers
161385
+ // (Firefox doesn't support AudioParam-based position/orientation properties)
161386
+ setPannerPosition(this.panner, 0, 0, 0);
161387
+ setPannerOrientation(this.panner, 0, 0, -1);
161383
161388
  this.panner.connect(destination);
161384
161389
  }
161385
161390
  static disposeAll() {
@@ -161395,14 +161400,10 @@ var pxsim;
161395
161400
  return undefined;
161396
161401
  }
161397
161402
  setPosition(x, y, z) {
161398
- this.panner.positionX.setTargetAtTime(x, 0, 0.02);
161399
- this.panner.positionY.setTargetAtTime(y, 0, 0.02);
161400
- this.panner.positionZ.setTargetAtTime(z, 0, 0.02);
161403
+ setPannerPosition(this.panner, x, y, z);
161401
161404
  }
161402
161405
  setOrientation(x, y, z) {
161403
- this.panner.orientationX.setTargetAtTime(x, 0, 0.02);
161404
- this.panner.orientationY.setTargetAtTime(y, 0, 0.02);
161405
- this.panner.orientationZ.setTargetAtTime(z, 0, 0.02);
161406
+ setPannerOrientation(this.panner, x, y, z);
161406
161407
  }
161407
161408
  setCone(innerAngle, outerAngle, outerGain) {
161408
161409
  this.panner.coneInnerAngle = innerAngle;
@@ -161427,9 +161428,9 @@ var pxsim;
161427
161428
  break;
161428
161429
  }
161429
161430
  }
161430
- get x() { return this.panner.positionX.value; }
161431
- get y() { return this.panner.positionY.value; }
161432
- get z() { return this.panner.positionZ.value; }
161431
+ get x() { var _a, _b; return (_b = (_a = this.panner.positionX) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
161432
+ get y() { var _a, _b; return (_b = (_a = this.panner.positionY) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
161433
+ get z() { var _a, _b; return (_b = (_a = this.panner.positionZ) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
161433
161434
  dispose() {
161434
161435
  this.panner.disconnect();
161435
161436
  this.panner = undefined;
@@ -161452,6 +161453,28 @@ var pxsim;
161452
161453
  SpatialAudioPlayer.nextId = 1;
161453
161454
  SpatialAudioPlayer.allPlayers = [];
161454
161455
  AudioContextManager.SpatialAudioPlayer = SpatialAudioPlayer;
161456
+ // Firefox does not support AudioParam-based positionX/Y/Z and orientationX/Y/Z
161457
+ // on PannerNode or AudioListener. Fall back to the deprecated setPosition()/setOrientation() methods.
161458
+ function setPannerPosition(panner, x, y, z) {
161459
+ if (panner.positionX) {
161460
+ panner.positionX.setTargetAtTime(x, 0, 0.02);
161461
+ panner.positionY.setTargetAtTime(y, 0, 0.02);
161462
+ panner.positionZ.setTargetAtTime(z, 0, 0.02);
161463
+ }
161464
+ else {
161465
+ panner.setPosition(x, y, z);
161466
+ }
161467
+ }
161468
+ function setPannerOrientation(panner, x, y, z) {
161469
+ if (panner.orientationX) {
161470
+ panner.orientationX.setTargetAtTime(x, 0, 0.02);
161471
+ panner.orientationY.setTargetAtTime(y, 0, 0.02);
161472
+ panner.orientationZ.setTargetAtTime(z, 0, 0.02);
161473
+ }
161474
+ else {
161475
+ panner.setOrientation(x, y, z);
161476
+ }
161477
+ }
161455
161478
  })(AudioContextManager = pxsim.AudioContextManager || (pxsim.AudioContextManager = {}));
161456
161479
  })(pxsim || (pxsim = {}));
161457
161480
  var pxsim;
package/built/pxtsim.js CHANGED
@@ -8386,9 +8386,16 @@ var pxsim;
8386
8386
  function setListenerPosition(x, y, z) {
8387
8387
  const ctx = context();
8388
8388
  if (ctx) {
8389
- ctx.listener.positionX.setTargetAtTime(x, 0, 0.02);
8390
- ctx.listener.positionY.setTargetAtTime(y, 0, 0.02);
8391
- ctx.listener.positionZ.setTargetAtTime(z, 0, 0.02);
8389
+ // Firefox does not support AudioParam-based positionX/Y/Z on AudioListener.
8390
+ // Fall back to the deprecated setPosition() method.
8391
+ if (ctx.listener.positionX) {
8392
+ ctx.listener.positionX.setTargetAtTime(x, 0, 0.02);
8393
+ ctx.listener.positionY.setTargetAtTime(y, 0, 0.02);
8394
+ ctx.listener.positionZ.setTargetAtTime(z, 0, 0.02);
8395
+ }
8396
+ else {
8397
+ ctx.listener.setPosition(x, y, z);
8398
+ }
8392
8399
  }
8393
8400
  }
8394
8401
  AudioContextManager.setListenerPosition = setListenerPosition;
@@ -10525,13 +10532,11 @@ var pxsim;
10525
10532
  this.panner = new PannerNode(context, {
10526
10533
  panningModel: 'HRTF',
10527
10534
  distanceModel: "linear",
10528
- positionX: 0,
10529
- positionY: 0,
10530
- positionZ: 0,
10531
- orientationX: 0,
10532
- orientationY: 0,
10533
- orientationZ: -1,
10534
10535
  });
10536
+ // Set initial position/orientation using the compat helpers
10537
+ // (Firefox doesn't support AudioParam-based position/orientation properties)
10538
+ setPannerPosition(this.panner, 0, 0, 0);
10539
+ setPannerOrientation(this.panner, 0, 0, -1);
10535
10540
  this.panner.connect(destination);
10536
10541
  }
10537
10542
  static disposeAll() {
@@ -10547,14 +10552,10 @@ var pxsim;
10547
10552
  return undefined;
10548
10553
  }
10549
10554
  setPosition(x, y, z) {
10550
- this.panner.positionX.setTargetAtTime(x, 0, 0.02);
10551
- this.panner.positionY.setTargetAtTime(y, 0, 0.02);
10552
- this.panner.positionZ.setTargetAtTime(z, 0, 0.02);
10555
+ setPannerPosition(this.panner, x, y, z);
10553
10556
  }
10554
10557
  setOrientation(x, y, z) {
10555
- this.panner.orientationX.setTargetAtTime(x, 0, 0.02);
10556
- this.panner.orientationY.setTargetAtTime(y, 0, 0.02);
10557
- this.panner.orientationZ.setTargetAtTime(z, 0, 0.02);
10558
+ setPannerOrientation(this.panner, x, y, z);
10558
10559
  }
10559
10560
  setCone(innerAngle, outerAngle, outerGain) {
10560
10561
  this.panner.coneInnerAngle = innerAngle;
@@ -10579,9 +10580,9 @@ var pxsim;
10579
10580
  break;
10580
10581
  }
10581
10582
  }
10582
- get x() { return this.panner.positionX.value; }
10583
- get y() { return this.panner.positionY.value; }
10584
- get z() { return this.panner.positionZ.value; }
10583
+ get x() { var _a, _b; return (_b = (_a = this.panner.positionX) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
10584
+ get y() { var _a, _b; return (_b = (_a = this.panner.positionY) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
10585
+ get z() { var _a, _b; return (_b = (_a = this.panner.positionZ) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0; }
10585
10586
  dispose() {
10586
10587
  this.panner.disconnect();
10587
10588
  this.panner = undefined;
@@ -10604,6 +10605,28 @@ var pxsim;
10604
10605
  SpatialAudioPlayer.nextId = 1;
10605
10606
  SpatialAudioPlayer.allPlayers = [];
10606
10607
  AudioContextManager.SpatialAudioPlayer = SpatialAudioPlayer;
10608
+ // Firefox does not support AudioParam-based positionX/Y/Z and orientationX/Y/Z
10609
+ // on PannerNode or AudioListener. Fall back to the deprecated setPosition()/setOrientation() methods.
10610
+ function setPannerPosition(panner, x, y, z) {
10611
+ if (panner.positionX) {
10612
+ panner.positionX.setTargetAtTime(x, 0, 0.02);
10613
+ panner.positionY.setTargetAtTime(y, 0, 0.02);
10614
+ panner.positionZ.setTargetAtTime(z, 0, 0.02);
10615
+ }
10616
+ else {
10617
+ panner.setPosition(x, y, z);
10618
+ }
10619
+ }
10620
+ function setPannerOrientation(panner, x, y, z) {
10621
+ if (panner.orientationX) {
10622
+ panner.orientationX.setTargetAtTime(x, 0, 0.02);
10623
+ panner.orientationY.setTargetAtTime(y, 0, 0.02);
10624
+ panner.orientationZ.setTargetAtTime(z, 0, 0.02);
10625
+ }
10626
+ else {
10627
+ panner.setOrientation(x, y, z);
10628
+ }
10629
+ }
10607
10630
  })(AudioContextManager = pxsim.AudioContextManager || (pxsim.AudioContextManager = {}));
10608
10631
  })(pxsim || (pxsim = {}));
10609
10632
  var pxsim;
@@ -24,6 +24,7 @@ export interface ButtonViewProps extends ContainerProps {
24
24
  }
25
25
  export interface ButtonProps extends ButtonViewProps {
26
26
  onClick: () => void;
27
+ onClickEvent?: (e: React.MouseEvent) => void;
27
28
  onRightClick?: () => void;
28
29
  onBlur?: () => void;
29
30
  onFocus?: () => void;