1
1
/**
2
- * Planck.js v1.0.4
2
+ * Planck.js v1.0.5
3
3
* @license The MIT license
4
4
* @copyright Copyright (c) 2023 Erin Catto, Ali Shakiba
5
5
*
7310
7310
};
7311
7311
/**
7312
7312
* Override the default friction mixture. You can call this in
7313
- * ContactListener.preSolve . This value persists until set or reset.
7313
+ * "pre-solve" callback . This value persists until set or reset.
7314
7314
*/
7315
7315
Contact.prototype.setFriction = function (friction) {
7316
7316
this.m_friction = friction;
7333
7333
};
7334
7334
/**
7335
7335
* Override the default restitution mixture. You can call this in
7336
- * ContactListener.preSolve . The value persists until you set or reset.
7336
+ * "pre-solve" callback . The value persists until you set or reset.
7337
7337
*/
7338
7338
Contact.prototype.setRestitution = function (restitution) {
7339
7339
this.m_restitution = restitution;
16116
16116
stats: stats$1
16117
16117
};
16118
16118
16119
+ /**
16120
+ * Stage.js 1.0.0-alpha.3
16121
+ *
16122
+ * @copyright Copyright (c) 2024 Ali Shakiba
16123
+ * @license The MIT License (MIT)
16124
+ *
16125
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16126
+ * of this software and associated documentation files (the "Software"), to deal
16127
+ * in the Software without restriction, including without limitation the rights
16128
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16129
+ * copies of the Software, and to permit persons to whom the Software is
16130
+ * furnished to do so, subject to the following conditions:
16131
+ *
16132
+ * The above copyright notice and this permission notice shall be included in all
16133
+ * copies or substantial portions of the Software.
16134
+ *
16135
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16136
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16137
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16138
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16139
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16140
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16141
+ * SOFTWARE.
16142
+ */
16119
16143
const math_random = Math.random;
16120
16144
const math_sqrt$1 = Math.sqrt;
16121
16145
function random(min, max) {
16679
16703
const NO_SELECTION = new TextureSelection(NO_TEXTURE);
16680
16704
const ATLAS_MEMO_BY_NAME = {};
16681
16705
const ATLAS_ARRAY = [];
16682
- const atlas = async function(def) {
16706
+ async function atlas (def) {
16683
16707
let atlas2;
16684
16708
if (def instanceof Atlas) {
16685
16709
atlas2 = def;
16692
16716
ATLAS_ARRAY.push(atlas2);
16693
16717
await atlas2.load();
16694
16718
return atlas2;
16695
- };
16696
- const texture = function (query) {
16719
+ }
16720
+ function texture(query) {
16697
16721
if ("string" !== typeof query) {
16698
16722
return new TextureSelection(query);
16699
16723
}
16720
16744
result = NO_SELECTION;
16721
16745
}
16722
16746
return result;
16723
- };
16747
+ }
16724
16748
class ResizableTexture extends Texture {
16725
16749
constructor(source, mode) {
16726
16750
super();
@@ -17625,30 +17649,30 @@
17625
17649
}
17626
17650
throw "Invalid node: " + obj;
17627
17651
}
17628
- const create = function () {
17652
+ function create() {
17629
17653
return layout();
17630
- };
17631
- const layer = function () {
17654
+ }
17655
+ function layer() {
17632
17656
return maximize();
17633
- };
17634
- const box = function () {
17657
+ }
17658
+ function box() {
17635
17659
return minimize();
17636
- };
17637
- const layout = function () {
17660
+ }
17661
+ function layout() {
17638
17662
return new Node();
17639
- };
17640
- const row = function (align) {
17663
+ }
17664
+ function row(align) {
17641
17665
return layout().row(align).label("Row");
17642
- };
17643
- const column = function (align) {
17666
+ }
17667
+ function column(align) {
17644
17668
return layout().column(align).label("Column");
17645
- };
17646
- const minimize = function () {
17669
+ }
17670
+ function minimize() {
17647
17671
return layout().minimize().label("Minimize");
17648
- };
17649
- const maximize = function () {
17672
+ }
17673
+ function maximize() {
17650
17674
return layout().maximize().label("Maximize");
17651
- };
17675
+ }
17652
17676
class Node {
17653
17677
constructor() {
17654
17678
this.uid = "node:" + uid();
@@ -18482,14 +18506,16 @@
18482
18506
return this;
18483
18507
}
18484
18508
}
18485
- const sprite = function (frame) {
18509
+ function sprite(frame) {
18486
18510
const sprite2 = new Sprite();
18487
18511
frame && sprite2.texture(frame);
18488
18512
return sprite2;
18489
- };
18513
+ }
18490
18514
class Sprite extends Node {
18491
18515
constructor() {
18492
18516
super();
18517
+ this._tiled = false;
18518
+ this._stretched = false;
18493
18519
this.prerenderContext = {};
18494
18520
this.label("Sprite");
18495
18521
this._textures = [];
18500
18526
if (this._image) {
18501
18527
this.pin("width", this._image.getWidth());
18502
18528
this.pin("height", this._image.getHeight());
18503
- this._textures[0] = new PipeTexture(this._image);
18529
+ if (this._tiled) {
18530
+ this._textures[0] = new ResizableTexture(this._image, "tile");
18531
+ } else if (this._stretched) {
18532
+ this._textures[0] = new ResizableTexture(this._image, "stretch");
18533
+ } else {
18534
+ this._textures[0] = new PipeTexture(this._image);
18535
+ }
18504
18536
this._textures.length = 1;
18505
18537
} else {
18506
18538
this.pin("width", 0);
@@ -18514,11 +18546,13 @@
18514
18546
return this.texture(frame);
18515
18547
}
18516
18548
tile(inner = false) {
18549
+ this._tiled = true;
18517
18550
const texture2 = new ResizableTexture(this._image, "tile");
18518
18551
this._textures[0] = texture2;
18519
18552
return this;
18520
18553
}
18521
18554
stretch(inner = false) {
18555
+ this._stretched = true;
18522
18556
const texture2 = new ResizableTexture(this._image, "stretch");
18523
18557
this._textures[0] = texture2;
18524
18558
return this;
@@ -18886,22 +18920,22 @@
18886
18920
CANCEL: "touchcancel mousecancel"
18887
18921
};
18888
18922
const ROOTS = [];
18889
- const pause = function () {
18923
+ function pause() {
18890
18924
for (let i = ROOTS.length - 1; i >= 0; i--) {
18891
18925
ROOTS[i].pause();
18892
18926
}
18893
- };
18894
- const resume = function () {
18927
+ }
18928
+ function resume() {
18895
18929
for (let i = ROOTS.length - 1; i >= 0; i--) {
18896
18930
ROOTS[i].resume();
18897
18931
}
18898
- };
18899
- const mount = function (configs = {}) {
18932
+ }
18933
+ function mount(configs = {}) {
18900
18934
const root = new Root();
18901
18935
root.mount(configs);
18902
18936
root.pointer = new Pointer().mount(root, root.dom);
18903
18937
return root;
18904
- };
18938
+ }
18905
18939
class Root extends Node {
18906
18940
constructor() {
18907
18941
super();
@@ -19145,12 +19179,12 @@
19145
19179
return this;
19146
19180
}
19147
19181
}
19148
- const anim = function (frames, fps) {
19182
+ function anim(frames, fps) {
19149
19183
const anim2 = new Anim();
19150
19184
anim2.frames(frames).gotoFrame(0);
19151
19185
fps && anim2.fps(fps);
19152
19186
return anim2;
19153
- };
19187
+ }
19154
19188
const FPS = 15;
19155
19189
class Anim extends Node {
19156
19190
constructor() {
@@ -19247,10 +19281,10 @@
19247
19281
return this;
19248
19282
}
19249
19283
}
19250
- const string = function(chars) {
19251
- return new Str ().frames(chars);
19252
- };
19253
- class Str extends Node {
19284
+ function monotype (chars) {
19285
+ return new Monotype ().frames(chars);
19286
+ }
19287
+ class Monotype extends Node {
19254
19288
constructor() {
19255
19289
super();
19256
19290
this.label("String");
19310
19344
return this;
19311
19345
}
19312
19346
}
19347
+ const string = monotype;
19348
+ const Str = Monotype;
19313
19349
const Stage = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19314
19350
__proto__: null,
19315
19351
Anim,
19319
19355
ImageTexture,
19320
19356
Math: math,
19321
19357
Matrix,
19358
+ Monotype,
19322
19359
Mouse,
19323
19360
Node,
19324
19361
POINTER_CANCEL,
19352
19389
maximize,
19353
19390
memoizeDraw,
19354
19391
minimize,
19392
+ monotype,
19355
19393
mount,
19356
19394
pause,
19357
19395
random,
0 commit comments