cubing 0.25.5 → 0.25.9
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/esm/{2x2x2.kpuzzle.json-RUB44MJV.js → 2x2x2.kpuzzle.json-BHTFIME6.js} +2 -2
- package/dist/esm/{2x2x2.kpuzzle.json-RUB44MJV.js.map → 2x2x2.kpuzzle.json-BHTFIME6.js.map} +0 -0
- package/dist/esm/{2x2x2.kpuzzle.svg-CQF2FTV7.js → 2x2x2.kpuzzle.svg-CYX37VBY.js} +2 -2
- package/dist/esm/{2x2x2.kpuzzle.svg-CQF2FTV7.js.map → 2x2x2.kpuzzle.svg-CYX37VBY.js.map} +0 -0
- package/dist/esm/{2x2x2.sgs.json-FBJ4RQ4C.js → 2x2x2.sgs.json-IO3JG72M.js} +6 -6
- package/dist/esm/{2x2x2.sgs.json-FBJ4RQ4C.js.map → 2x2x2.sgs.json-IO3JG72M.js.map} +0 -0
- package/dist/esm/{3d-dynamic-TNYERP4O.js → 3d-dynamic-HS4RJWAT.js} +8 -8
- package/dist/esm/{3d-dynamic-TNYERP4O.js.map → 3d-dynamic-HS4RJWAT.js.map} +1 -1
- package/dist/esm/{3x3x3-ll.kpuzzle.svg-53CBPG5O.js → 3x3x3-ll.kpuzzle.svg-KZNSV76X.js} +2 -2
- package/dist/esm/{3x3x3-ll.kpuzzle.svg-53CBPG5O.js.map → 3x3x3-ll.kpuzzle.svg-KZNSV76X.js.map} +0 -0
- package/dist/esm/{3x3x3-min2phase-FPRJ5PCJ.js → 3x3x3-min2phase-UBW46KDU.js} +2 -2
- package/dist/esm/{3x3x3-min2phase-FPRJ5PCJ.js.map → 3x3x3-min2phase-UBW46KDU.js.map} +0 -0
- package/dist/esm/{3x3x3.kpuzzle.svg-ERSSH66P.js → 3x3x3.kpuzzle.svg-5U7LUACF.js} +2 -2
- package/dist/esm/{3x3x3.kpuzzle.svg-ERSSH66P.js.map → 3x3x3.kpuzzle.svg-5U7LUACF.js.map} +0 -0
- package/dist/esm/{444-solver-YZ6PC54L.js → 444-solver-4R3P6TGG.js} +6 -6
- package/dist/esm/{444-solver-YZ6PC54L.js.map → 444-solver-4R3P6TGG.js.map} +0 -0
- package/dist/esm/alg/index.js +2 -2
- package/dist/esm/bluetooth/index.js +5 -5
- package/dist/esm/{chunk-JLNFWJIT.js → chunk-2YDIR5JL.js} +9 -6
- package/dist/esm/{chunk-JLNFWJIT.js.map → chunk-2YDIR5JL.js.map} +2 -2
- package/dist/esm/{chunk-LGM2HUUG.js → chunk-33FD473T.js} +5 -5
- package/dist/esm/{chunk-LGM2HUUG.js.map → chunk-33FD473T.js.map} +0 -0
- package/dist/esm/{chunk-TXTMBIUR.js → chunk-6BUCXDZU.js} +3 -3
- package/dist/esm/{chunk-TXTMBIUR.js.map → chunk-6BUCXDZU.js.map} +0 -0
- package/dist/esm/{chunk-QEDC2QTN.js → chunk-C6I4KFI2.js} +4 -4
- package/dist/esm/{chunk-QEDC2QTN.js.map → chunk-C6I4KFI2.js.map} +0 -0
- package/dist/esm/{chunk-WDJDRVZZ.js → chunk-CS6S3OZ5.js} +2 -2
- package/dist/esm/{chunk-WDJDRVZZ.js.map → chunk-CS6S3OZ5.js.map} +0 -0
- package/dist/esm/{chunk-EWRBHQFX.js → chunk-DO7GZAW4.js} +35 -35
- package/dist/esm/{chunk-EWRBHQFX.js.map → chunk-DO7GZAW4.js.map} +1 -1
- package/dist/esm/{chunk-27KJGD3S.js → chunk-FB7SFELN.js} +2 -2
- package/dist/esm/{chunk-27KJGD3S.js.map → chunk-FB7SFELN.js.map} +0 -0
- package/dist/esm/{chunk-IVQ4ITE2.js → chunk-GBMX6FHY.js} +2 -2
- package/dist/esm/{chunk-IVQ4ITE2.js.map → chunk-GBMX6FHY.js.map} +1 -1
- package/dist/esm/{chunk-RJSX2HO4.js → chunk-LYU3GNBG.js} +3 -3
- package/dist/esm/{chunk-RJSX2HO4.js.map → chunk-LYU3GNBG.js.map} +0 -0
- package/dist/esm/{chunk-WO2AXYFE.js → chunk-MGJA5U5O.js} +1 -1
- package/dist/esm/{chunk-WO2AXYFE.js.map → chunk-MGJA5U5O.js.map} +0 -0
- package/dist/esm/{chunk-U2TSTTDG.js → chunk-NSLR2SC4.js} +2 -2
- package/dist/esm/{chunk-U2TSTTDG.js.map → chunk-NSLR2SC4.js.map} +0 -0
- package/dist/esm/{chunk-F5WNHV7V.js → chunk-ODQRVWJB.js} +3 -3
- package/dist/esm/{chunk-F5WNHV7V.js.map → chunk-ODQRVWJB.js.map} +1 -1
- package/dist/esm/{chunk-KJZNEDOV.js → chunk-OFGQQQBY.js} +4 -4
- package/dist/esm/{chunk-KJZNEDOV.js.map → chunk-OFGQQQBY.js.map} +0 -0
- package/dist/esm/{chunk-4VNM5SER.js → chunk-Q7QSEHWH.js} +6 -6
- package/dist/esm/{chunk-4VNM5SER.js.map → chunk-Q7QSEHWH.js.map} +1 -1
- package/dist/esm/{chunk-Y32HHZUY.js → chunk-YAOUFM4D.js} +24 -6
- package/dist/esm/chunk-YAOUFM4D.js.map +7 -0
- package/dist/esm/{chunk-V5K5JN2N.js → chunk-YCLG3ZLR.js} +119 -102
- package/dist/esm/chunk-YCLG3ZLR.js.map +7 -0
- package/dist/esm/{clock.kpuzzle.json-BQKNKV3G.js → clock.kpuzzle.json-PYHONPBY.js} +2 -2
- package/dist/esm/{clock.kpuzzle.json-BQKNKV3G.js.map → clock.kpuzzle.json-PYHONPBY.js.map} +0 -0
- package/dist/esm/{clock.kpuzzle.svg-B7TMN3SY.js → clock.kpuzzle.svg-JSRDCSQF.js} +2 -2
- package/dist/esm/{clock.kpuzzle.svg-B7TMN3SY.js.map → clock.kpuzzle.svg-JSRDCSQF.js.map} +0 -0
- package/dist/esm/{fto-solver-HI6NIV74.js → fto-solver-E6YEK26S.js} +2 -2
- package/dist/esm/{fto-solver-HI6NIV74.js.map → fto-solver-E6YEK26S.js.map} +0 -0
- package/dist/esm/{fto.dynamic-RAXDXLKL.js → fto.dynamic-TCAH2G3H.js} +7 -7
- package/dist/esm/{fto.dynamic-RAXDXLKL.js.map → fto.dynamic-TCAH2G3H.js.map} +0 -0
- package/dist/esm/{kilominx.kpuzzle.svg-7XJBOKFU.js → kilominx.kpuzzle.svg-ZLRTRUTM.js} +2 -2
- package/dist/esm/{kilominx.kpuzzle.svg-7XJBOKFU.js.map → kilominx.kpuzzle.svg-ZLRTRUTM.js.map} +0 -0
- package/dist/esm/{kilosolver-N6JM5PUY.js → kilosolver-IQ4LB7VP.js} +5 -4
- package/dist/esm/{kilosolver-N6JM5PUY.js.map → kilosolver-IQ4LB7VP.js.map} +1 -1
- package/dist/esm/kpuzzle/index.js +3 -3
- package/dist/esm/{master_tetraminx-solver-KBQJGW4A.js → master_tetraminx-solver-JQSMYUQN.js} +5 -4
- package/dist/esm/{master_tetraminx-solver-KBQJGW4A.js.map → master_tetraminx-solver-JQSMYUQN.js.map} +1 -1
- package/dist/esm/megaminx.sgs.json-O2B5OU3T.js +16 -0
- package/dist/esm/{megaminx.sgs.json-3ZEDZMWF.js.map → megaminx.sgs.json-O2B5OU3T.js.map} +0 -0
- package/dist/esm/notation/index.js +3 -3
- package/dist/esm/protocol/index.js +4 -4
- package/dist/esm/puzzle-geometry/index.js +3 -3
- package/dist/esm/puzzles/index.js +4 -4
- package/dist/esm/{pyraminx.kpuzzle.svg-QBBMZVDY.js → pyraminx.kpuzzle.svg-UHDZCBET.js} +2 -2
- package/dist/esm/{pyraminx.kpuzzle.svg-QBBMZVDY.js.map → pyraminx.kpuzzle.svg-UHDZCBET.js.map} +0 -0
- package/dist/esm/pyraminx.sgs.json-Z5KUYMLD.js +14 -0
- package/dist/esm/{pyraminx.sgs.json-AUUH6ELM.js.map → pyraminx.sgs.json-Z5KUYMLD.js.map} +0 -0
- package/dist/esm/redi_cube-S63AVKYL.js +565 -0
- package/dist/esm/redi_cube-S63AVKYL.js.map +7 -0
- package/dist/esm/redi_cube.kpuzzle.json-43CP47Z6.js +66 -0
- package/dist/esm/redi_cube.kpuzzle.json-43CP47Z6.js.map +7 -0
- package/dist/esm/redi_cube.kpuzzle.svg-3DWDYE3O.js +160 -0
- package/dist/esm/redi_cube.kpuzzle.svg-3DWDYE3O.js.map +7 -0
- package/dist/esm/scramble/index.js +7 -7
- package/dist/esm/search/index.js +7 -7
- package/dist/esm/{search-worker-js-entry-B76LGKC2.js → search-worker-js-entry-YV4TZPNY.js} +120 -69
- package/dist/esm/search-worker-js-entry-YV4TZPNY.js.map +7 -0
- package/dist/esm/{search-worker-ts-entry-JZTMF3AC.js → search-worker-ts-entry-ZHRSIMXB.js} +5 -5
- package/dist/esm/{search-worker-ts-entry-JZTMF3AC.js.map → search-worker-ts-entry-ZHRSIMXB.js.map} +0 -0
- package/dist/esm/skewb.sgs.json-GISOONJZ.js +16 -0
- package/dist/esm/{skewb.sgs.json-6NDFH63U.js.map → skewb.sgs.json-GISOONJZ.js.map} +0 -0
- package/dist/esm/{sq1-hyperorbit.kpuzzle.json-4XS5YACO.js → sq1-hyperorbit.kpuzzle.json-AMXAFQCM.js} +2 -2
- package/dist/esm/{sq1-hyperorbit.kpuzzle.json-4XS5YACO.js.map → sq1-hyperorbit.kpuzzle.json-AMXAFQCM.js.map} +0 -0
- package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-ID57EER7.js → sq1-hyperorbit.kpuzzle.svg-MNHJTJ6V.js} +2 -2
- package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-ID57EER7.js.map → sq1-hyperorbit.kpuzzle.svg-MNHJTJ6V.js.map} +0 -0
- package/dist/esm/{sq1-solver-P3IWWET7.js → sq1-solver-NJ7B44MA.js} +2 -2
- package/dist/esm/{sq1-solver-P3IWWET7.js.map → sq1-solver-NJ7B44MA.js.map} +0 -0
- package/dist/esm/stream/index.js +2 -2
- package/dist/esm/twisty/index.js +542 -534
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/worker-inside-generated-string-JYZKHSA6.js +3674 -0
- package/dist/esm/worker-inside-generated-string-JYZKHSA6.js.map +7 -0
- package/dist/types/kpuzzle/KPuzzleDefinition.d.ts +1 -0
- package/dist/types/kpuzzle/KState.d.ts +1 -0
- package/dist/types/kpuzzle/KTransformation.d.ts +1 -0
- package/dist/types/puzzles/implementations/redi-cube/index.d.ts +2 -0
- package/dist/types/puzzles/implementations/redi-cube/redi_cube.kpuzzle.json.d.ts +2 -0
- package/dist/types/puzzles/implementations/redi-cube/redi_cube.kpuzzle.svg.d.ts +1 -0
- package/dist/types/search/inside/api.d.ts +6 -0
- package/dist/types/search/inside/solve/puzzles/redi_cube.d.ts +2 -0
- package/dist/types/search/outside.d.ts +2 -0
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts +27 -46
- package/dist/types/twisty/model/TwistySceneModel.d.ts +27 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +1 -0
- package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +3 -3
- package/dist/types/vendor/xyzzy/fto-solver-original.d.ts +1 -30
- package/dist/types/vendor/xyzzy/redi_cube.d.ts +2 -0
- package/package.json +21 -22
- package/dist/esm/chunk-V5K5JN2N.js.map +0 -7
- package/dist/esm/chunk-Y32HHZUY.js.map +0 -7
- package/dist/esm/megaminx.sgs.json-3ZEDZMWF.js +0 -16
- package/dist/esm/pyraminx.sgs.json-AUUH6ELM.js +0 -14
- package/dist/esm/search-worker-js-entry-B76LGKC2.js.map +0 -7
- package/dist/esm/skewb.sgs.json-6NDFH63U.js +0 -16
- package/dist/esm/worker-inside-generated-string-QVH4RRM7.js +0 -3522
- package/dist/esm/worker-inside-generated-string-QVH4RRM7.js.map +0 -7
- package/dist/types/vendor/xyzzy/rediscrambler.d.ts +0 -72
package/dist/esm/twisty/index.js
CHANGED
|
@@ -10,53 +10,41 @@ import {
|
|
|
10
10
|
TwistyPropDerived,
|
|
11
11
|
TwistyPropSource,
|
|
12
12
|
proxy3D
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-Q7QSEHWH.js";
|
|
14
14
|
import {
|
|
15
15
|
countAnimatedLeaves,
|
|
16
16
|
countMoves
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-NSLR2SC4.js";
|
|
18
18
|
import {
|
|
19
19
|
cube3x3x3,
|
|
20
20
|
cubeAppearance,
|
|
21
21
|
customPGPuzzleLoader,
|
|
22
22
|
puzzles
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-YCLG3ZLR.js";
|
|
24
|
+
import "../chunk-YAOUFM4D.js";
|
|
25
25
|
import {
|
|
26
26
|
Alg,
|
|
27
27
|
AlgBuilder,
|
|
28
28
|
Conjugate,
|
|
29
29
|
Grouping,
|
|
30
|
-
IterationDirection,
|
|
31
30
|
Move,
|
|
32
31
|
TraversalDownUp,
|
|
33
32
|
TraversalUp,
|
|
34
33
|
direct,
|
|
35
34
|
directedGenerator,
|
|
36
35
|
experimentalAppendMove
|
|
37
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-DO7GZAW4.js";
|
|
38
37
|
import {
|
|
39
38
|
__privateAdd,
|
|
40
39
|
__privateGet,
|
|
41
40
|
__privateMethod,
|
|
42
41
|
__privateSet
|
|
43
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-MGJA5U5O.js";
|
|
44
43
|
|
|
45
44
|
// src/cubing/twisty/controllers/AnimationTypes.ts
|
|
46
|
-
var Direction;
|
|
47
|
-
(function(Direction2) {
|
|
48
|
-
Direction2[Direction2["Forwards"] = 1] = "Forwards";
|
|
49
|
-
Direction2[Direction2["Paused"] = 0] = "Paused";
|
|
50
|
-
Direction2[Direction2["Backwards"] = -1] = "Backwards";
|
|
51
|
-
})(Direction || (Direction = {}));
|
|
52
45
|
function directionScalar(direction) {
|
|
53
46
|
return direction;
|
|
54
47
|
}
|
|
55
|
-
var BoundaryType;
|
|
56
|
-
(function(BoundaryType2) {
|
|
57
|
-
BoundaryType2["Move"] = "move";
|
|
58
|
-
BoundaryType2["EntireTimeline"] = "entire-timeline";
|
|
59
|
-
})(BoundaryType || (BoundaryType = {}));
|
|
60
48
|
|
|
61
49
|
// src/cubing/twisty/controllers/RenderScheduler.ts
|
|
62
50
|
var RenderScheduler = class {
|
|
@@ -173,7 +161,7 @@ var TwistyAnimationController = class {
|
|
|
173
161
|
this.delegate = delegate;
|
|
174
162
|
__privateAdd(this, _effectiveTimestampMilliseconds);
|
|
175
163
|
this.playing = false;
|
|
176
|
-
this.direction =
|
|
164
|
+
this.direction = 1 /* Forwards */;
|
|
177
165
|
this.lastDatestamp = 0;
|
|
178
166
|
this.scheduler = new RenderScheduler(this.animFrame.bind(this));
|
|
179
167
|
__privateAdd(this, _animFrameEffectiveTimestampStaleDropper, new StaleDropper());
|
|
@@ -217,14 +205,14 @@ var TwistyAnimationController = class {
|
|
|
217
205
|
}
|
|
218
206
|
}
|
|
219
207
|
async play(options) {
|
|
220
|
-
const direction = options?.direction ??
|
|
208
|
+
const direction = options?.direction ?? 1 /* Forwards */;
|
|
221
209
|
const coarseTimelineInfo = await this.model.coarseTimelineInfo.get();
|
|
222
210
|
if (options?.autoSkipToOtherEndIfStartingAtBoundary ?? true) {
|
|
223
|
-
if (direction ===
|
|
211
|
+
if (direction === 1 /* Forwards */ && coarseTimelineInfo.atEnd) {
|
|
224
212
|
this.model.timestampRequest.set("start");
|
|
225
213
|
this.delegate.flash();
|
|
226
214
|
}
|
|
227
|
-
if (direction ===
|
|
215
|
+
if (direction === -1 /* Backwards */ && coarseTimelineInfo.atStart) {
|
|
228
216
|
this.model.timestampRequest.set("end");
|
|
229
217
|
this.delegate.flash();
|
|
230
218
|
}
|
|
@@ -232,7 +220,7 @@ var TwistyAnimationController = class {
|
|
|
232
220
|
this.model.playingInfo.set({
|
|
233
221
|
playing: true,
|
|
234
222
|
direction,
|
|
235
|
-
untilBoundary: options?.untilBoundary ??
|
|
223
|
+
untilBoundary: options?.untilBoundary ?? "entire-timeline" /* EntireTimeline */,
|
|
236
224
|
loop: options?.loop ?? false
|
|
237
225
|
});
|
|
238
226
|
this.playing = true;
|
|
@@ -245,7 +233,7 @@ var TwistyAnimationController = class {
|
|
|
245
233
|
this.scheduler.cancelAnimFrame();
|
|
246
234
|
this.model.playingInfo.set({
|
|
247
235
|
playing: false,
|
|
248
|
-
untilBoundary:
|
|
236
|
+
untilBoundary: "entire-timeline" /* EntireTimeline */
|
|
249
237
|
});
|
|
250
238
|
}
|
|
251
239
|
async animFrame(frameDatestamp) {
|
|
@@ -266,11 +254,11 @@ var TwistyAnimationController = class {
|
|
|
266
254
|
return;
|
|
267
255
|
}
|
|
268
256
|
let end = currentMoveInfo.earliestEnd;
|
|
269
|
-
if (currentMoveInfo.currentMoves.length === 0 || playingInfo.untilBoundary ===
|
|
257
|
+
if (currentMoveInfo.currentMoves.length === 0 || playingInfo.untilBoundary === "entire-timeline" /* EntireTimeline */) {
|
|
270
258
|
end = timeRange.end;
|
|
271
259
|
}
|
|
272
260
|
let start = currentMoveInfo.latestStart;
|
|
273
|
-
if (currentMoveInfo.currentMoves.length === 0 || playingInfo.untilBoundary ===
|
|
261
|
+
if (currentMoveInfo.currentMoves.length === 0 || playingInfo.untilBoundary === "entire-timeline" /* EntireTimeline */) {
|
|
274
262
|
start = timeRange.start;
|
|
275
263
|
}
|
|
276
264
|
let delta = (frameDatestamp - lastDatestamp) * directionScalar(this.direction) * tempoScale;
|
|
@@ -388,7 +376,7 @@ var _cssSourceMap;
|
|
|
388
376
|
var ManagedCustomElement = class extends HTMLElementShim {
|
|
389
377
|
constructor(options) {
|
|
390
378
|
super();
|
|
391
|
-
__privateAdd(this, _cssSourceMap, new Map());
|
|
379
|
+
__privateAdd(this, _cssSourceMap, /* @__PURE__ */ new Map());
|
|
392
380
|
this.shadow = this.attachShadow({ mode: options?.mode ?? "closed" });
|
|
393
381
|
this.contentWrapper = document.createElement("div");
|
|
394
382
|
this.contentWrapper.classList.add("wrapper");
|
|
@@ -717,7 +705,7 @@ var Twisty2DPuzzle = class extends ManagedCustomElement {
|
|
|
717
705
|
if (position.movesInProgress.length > 0) {
|
|
718
706
|
const move = position.movesInProgress[0].move;
|
|
719
707
|
let partialMove = move;
|
|
720
|
-
if (position.movesInProgress[0].direction ===
|
|
708
|
+
if (position.movesInProgress[0].direction === -1 /* Backwards */) {
|
|
721
709
|
partialMove = move.invert();
|
|
722
710
|
}
|
|
723
711
|
const newState = position.state.applyMove(partialMove);
|
|
@@ -774,7 +762,7 @@ var Twisty2DPuzzleWrapper = class {
|
|
|
774
762
|
__privateAdd(this, _freshListenerManager2, new FreshListenerManager());
|
|
775
763
|
__privateAdd(this, _cachedTwisty2DPuzzle, null);
|
|
776
764
|
this.twisty2DPuzzle();
|
|
777
|
-
__privateGet(this, _freshListenerManager2).addListener(this.model.stickering, async (stickering) => {
|
|
765
|
+
__privateGet(this, _freshListenerManager2).addListener(this.model.twistySceneModel.stickering, async (stickering) => {
|
|
778
766
|
(await this.twisty2DPuzzle()).experimentalSetStickering(stickering);
|
|
779
767
|
});
|
|
780
768
|
}
|
|
@@ -810,7 +798,7 @@ var Twisty2DSceneWrapper = class extends ManagedCustomElement {
|
|
|
810
798
|
async connectedCallback() {
|
|
811
799
|
this.addCSS(twistyViewerWrapperCSS);
|
|
812
800
|
if (this.model) {
|
|
813
|
-
__privateGet(this, _freshListenerManager3).addListener(this.model.puzzleLoader, this.onPuzzleLoader.bind(this));
|
|
801
|
+
__privateGet(this, _freshListenerManager3).addListener(this.model.twistyPlayerModel.puzzleLoader, this.onPuzzleLoader.bind(this));
|
|
814
802
|
}
|
|
815
803
|
}
|
|
816
804
|
async scene() {
|
|
@@ -832,7 +820,7 @@ var Twisty2DSceneWrapper = class extends ManagedCustomElement {
|
|
|
832
820
|
}
|
|
833
821
|
async onPuzzleLoader(puzzleLoader) {
|
|
834
822
|
__privateGet(this, _currentTwisty2DPuzzleWrapper)?.disconnect();
|
|
835
|
-
const twisty2DPuzzleWrapper = new Twisty2DPuzzleWrapper(this.model, this, puzzleLoader, this.effectiveVisualization);
|
|
823
|
+
const twisty2DPuzzleWrapper = new Twisty2DPuzzleWrapper(this.model.twistyPlayerModel, this, puzzleLoader, this.effectiveVisualization);
|
|
836
824
|
this.setCurrentTwisty2DPuzzleWrapper(twisty2DPuzzleWrapper);
|
|
837
825
|
}
|
|
838
826
|
};
|
|
@@ -896,19 +884,19 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
896
884
|
this.disconnect();
|
|
897
885
|
}
|
|
898
886
|
});
|
|
899
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.hintFacelet, async (hintFaceletStyle) => {
|
|
887
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.twistySceneModel.hintFacelet, async (hintFaceletStyle) => {
|
|
900
888
|
(await this.twisty3DPuzzle()).experimentalUpdateOptions({
|
|
901
889
|
hintFacelets: hintFaceletStyle === "auto" ? "floating" : hintFaceletStyle
|
|
902
890
|
});
|
|
903
891
|
this.scheduleRender();
|
|
904
892
|
});
|
|
905
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.foundationDisplay, async (foundationDisplay) => {
|
|
893
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.twistySceneModel.foundationDisplay, async (foundationDisplay) => {
|
|
906
894
|
(await this.twisty3DPuzzle()).experimentalUpdateOptions({
|
|
907
895
|
showFoundation: foundationDisplay !== "none"
|
|
908
896
|
});
|
|
909
897
|
this.scheduleRender();
|
|
910
898
|
});
|
|
911
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.stickering, async (stickering) => {
|
|
899
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.twistySceneModel.stickering, async (stickering) => {
|
|
912
900
|
if ("setStickering" in await this.twisty3DPuzzle()) {
|
|
913
901
|
(await this.twisty3DPuzzle()).setStickering(stickering);
|
|
914
902
|
this.scheduleRender();
|
|
@@ -932,7 +920,10 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
932
920
|
}
|
|
933
921
|
}
|
|
934
922
|
});
|
|
935
|
-
__privateGet(this, _freshListenerManager4).addMultiListener([
|
|
923
|
+
__privateGet(this, _freshListenerManager4).addMultiListener([
|
|
924
|
+
this.model.twistySceneModel.foundationStickerSprite,
|
|
925
|
+
this.model.twistySceneModel.hintStickerSprite
|
|
926
|
+
], async (inputs) => {
|
|
936
927
|
if ("experimentalUpdateTexture" in await this.twisty3DPuzzle()) {
|
|
937
928
|
(await this.twisty3DPuzzle()).experimentalUpdateTexture(true, ...inputs);
|
|
938
929
|
this.scheduleRender();
|
|
@@ -950,9 +941,9 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
950
941
|
const proxyPromise = proxy3D();
|
|
951
942
|
if (this.puzzleLoader.id === "3x3x3" && this.visualizationStrategy === "Cube3D") {
|
|
952
943
|
const [foundationSprite, hintSprite, experimentalStickering] = await Promise.all([
|
|
953
|
-
this.model.foundationStickerSprite.get(),
|
|
954
|
-
this.model.hintStickerSprite.get(),
|
|
955
|
-
this.model.stickering.get()
|
|
944
|
+
this.model.twistySceneModel.foundationStickerSprite.get(),
|
|
945
|
+
this.model.twistySceneModel.hintStickerSprite.get(),
|
|
946
|
+
this.model.twistySceneModel.stickering.get()
|
|
956
947
|
]);
|
|
957
948
|
return (await proxyPromise).cube3DShim({
|
|
958
949
|
foundationSprite,
|
|
@@ -961,9 +952,9 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
961
952
|
});
|
|
962
953
|
} else {
|
|
963
954
|
const [hintFacelets, foundationSprite, hintSprite] = await Promise.all([
|
|
964
|
-
this.model.hintFacelet.get(),
|
|
965
|
-
this.model.foundationStickerSprite.get(),
|
|
966
|
-
this.model.hintStickerSprite.get()
|
|
955
|
+
this.model.twistySceneModel.hintFacelet.get(),
|
|
956
|
+
this.model.twistySceneModel.foundationStickerSprite.get(),
|
|
957
|
+
this.model.twistySceneModel.hintStickerSprite.get()
|
|
967
958
|
]);
|
|
968
959
|
const pg3d = (await proxyPromise).pg3dShim(this.puzzleLoader, hintFacelets === "auto" ? "floating" : hintFacelets);
|
|
969
960
|
pg3d.then((p) => p.experimentalUpdateTexture(true, foundationSprite ?? void 0, hintSprite ?? void 0));
|
|
@@ -1171,7 +1162,7 @@ var DragTracker = class extends EventTarget {
|
|
|
1171
1162
|
__privateAdd(this, _registerLazyListeners);
|
|
1172
1163
|
__privateAdd(this, _clear);
|
|
1173
1164
|
__privateAdd(this, _trackDrag);
|
|
1174
|
-
__privateAdd(this, _dragInfoMap, new Map());
|
|
1165
|
+
__privateAdd(this, _dragInfoMap, /* @__PURE__ */ new Map());
|
|
1175
1166
|
__privateAdd(this, _lazyListenersRegistered, false);
|
|
1176
1167
|
target.addEventListener("pointerdown", this.onPointerDown.bind(this));
|
|
1177
1168
|
this.target.addEventListener("contextmenu", (e) => {
|
|
@@ -1364,8 +1355,8 @@ var TwistyOrbitControls = class {
|
|
|
1364
1355
|
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
1365
1356
|
const temperedX = this.temperMovement(movementX / minDim);
|
|
1366
1357
|
const temperedY = this.temperMovement(movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
1367
|
-
this.model.orbitCoordinatesRequest.set((async () => {
|
|
1368
|
-
const prevCoords = await this.model.orbitCoordinates.get();
|
|
1358
|
+
this.model.twistySceneModel.orbitCoordinatesRequest.set((async () => {
|
|
1359
|
+
const prevCoords = await this.model.twistySceneModel.orbitCoordinates.get();
|
|
1369
1360
|
const newCoords = {
|
|
1370
1361
|
latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
|
|
1371
1362
|
longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
|
|
@@ -1497,7 +1488,7 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1497
1488
|
return __privateGet(this, _cachedOrbitControls) ?? __privateSet(this, _cachedOrbitControls, (async () => {
|
|
1498
1489
|
const orbitControls = new TwistyOrbitControls(this.model, !!this.options?.backView, (await this.canvasInfo()).canvas, await __privateMethod(this, _dragTracker, dragTracker_fn).call(this));
|
|
1499
1490
|
if (this.model) {
|
|
1500
|
-
this.addListener(this.model.orbitCoordinates, async (orbitCoordinates) => {
|
|
1491
|
+
this.addListener(this.model.twistySceneModel.orbitCoordinates, async (orbitCoordinates) => {
|
|
1501
1492
|
const camera = await this.camera();
|
|
1502
1493
|
setCameraFromOrbitCoordinates(camera, orbitCoordinates, this.options?.backView);
|
|
1503
1494
|
this.scheduleRender();
|
|
@@ -1543,7 +1534,7 @@ _setupBasicPresses = new WeakSet();
|
|
|
1543
1534
|
setupBasicPresses_fn = async function() {
|
|
1544
1535
|
const dragTracker = await __privateMethod(this, _dragTracker, dragTracker_fn).call(this);
|
|
1545
1536
|
dragTracker.addEventListener("press", async (e) => {
|
|
1546
|
-
const movePressInput = await this.model.movePressInput.get();
|
|
1537
|
+
const movePressInput = await this.model.twistySceneModel.movePressInput.get();
|
|
1547
1538
|
if (movePressInput !== "basic") {
|
|
1548
1539
|
return;
|
|
1549
1540
|
}
|
|
@@ -1581,7 +1572,7 @@ onResize_fn = async function() {
|
|
|
1581
1572
|
canvasInfo.canvas.width = w * pixelRatio();
|
|
1582
1573
|
canvasInfo.canvas.height = h * pixelRatio();
|
|
1583
1574
|
canvasInfo.canvas.style.width = w.toString();
|
|
1584
|
-
canvasInfo.canvas.style.height =
|
|
1575
|
+
canvasInfo.canvas.style.height = h.toString();
|
|
1585
1576
|
} else {
|
|
1586
1577
|
const renderer = await this.renderer();
|
|
1587
1578
|
renderer.setSize(w, h, true);
|
|
@@ -1618,7 +1609,7 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
|
|
|
1618
1609
|
__privateAdd(this, _freshListenerManager5, new FreshListenerManager());
|
|
1619
1610
|
__privateAdd(this, _backViewVantage, null);
|
|
1620
1611
|
__privateAdd(this, _cachedScene2, void 0);
|
|
1621
|
-
__privateAdd(this, _vantages, new Set());
|
|
1612
|
+
__privateAdd(this, _vantages, /* @__PURE__ */ new Set());
|
|
1622
1613
|
__privateAdd(this, _currentTwisty3DPuzzleWrapper, null);
|
|
1623
1614
|
__privateAdd(this, _twisty3DStaleDropper, new StaleDropper());
|
|
1624
1615
|
}
|
|
@@ -2009,8 +2000,8 @@ onCommand_fn = function(command) {
|
|
|
2009
2000
|
break;
|
|
2010
2001
|
case "play-step-backwards":
|
|
2011
2002
|
this.controller?.animationController.play({
|
|
2012
|
-
direction:
|
|
2013
|
-
untilBoundary:
|
|
2003
|
+
direction: -1 /* Backwards */,
|
|
2004
|
+
untilBoundary: "move" /* Move */
|
|
2014
2005
|
});
|
|
2015
2006
|
break;
|
|
2016
2007
|
case "play-pause":
|
|
@@ -2018,8 +2009,8 @@ onCommand_fn = function(command) {
|
|
|
2018
2009
|
break;
|
|
2019
2010
|
case "play-step":
|
|
2020
2011
|
this.controller?.animationController.play({
|
|
2021
|
-
direction:
|
|
2022
|
-
untilBoundary:
|
|
2012
|
+
direction: 1 /* Forwards */,
|
|
2013
|
+
untilBoundary: "move" /* Move */
|
|
2023
2014
|
});
|
|
2024
2015
|
break;
|
|
2025
2016
|
case "jump-to-end":
|
|
@@ -2186,11 +2177,11 @@ async function screenshot(model, options) {
|
|
|
2186
2177
|
const scene = new (await THREEJS).Scene();
|
|
2187
2178
|
const twisty3DWrapper = new Twisty3DPuzzleWrapper(model, { scheduleRender: () => {
|
|
2188
2179
|
} }, await model.puzzleLoader.get(), await model.visualizationStrategy.get());
|
|
2189
|
-
await model.stickering.get();
|
|
2180
|
+
await model.twistySceneModel.stickering.get();
|
|
2190
2181
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2191
2182
|
await model.legacyPosition.get();
|
|
2192
2183
|
scene.add(await twisty3DWrapper.twisty3DPuzzle());
|
|
2193
|
-
const orbitCoordinates = await model.orbitCoordinates.get();
|
|
2184
|
+
const orbitCoordinates = await model.twistySceneModel.orbitCoordinates.get();
|
|
2194
2185
|
await setCameraFromOrbitCoordinates(camera, orbitCoordinates);
|
|
2195
2186
|
const renderer = new (await THREEJS).WebGLRenderer({
|
|
2196
2187
|
antialias: true,
|
|
@@ -2293,6 +2284,26 @@ twisty-scrubber {
|
|
|
2293
2284
|
}
|
|
2294
2285
|
`);
|
|
2295
2286
|
|
|
2287
|
+
// src/cubing/twisty/model/props/general/ArbitraryStringProp.ts
|
|
2288
|
+
var ArbitraryStringProp = class extends SimpleTwistyPropSource {
|
|
2289
|
+
getDefaultValue() {
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
};
|
|
2293
|
+
|
|
2294
|
+
// src/cubing/twisty/model/props/general/URLProp.ts
|
|
2295
|
+
var URLProp = class extends TwistyPropSource {
|
|
2296
|
+
getDefaultValue() {
|
|
2297
|
+
return null;
|
|
2298
|
+
}
|
|
2299
|
+
derive(input) {
|
|
2300
|
+
if (typeof input === "string") {
|
|
2301
|
+
return new URL(input, location.href);
|
|
2302
|
+
}
|
|
2303
|
+
return input;
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2296
2307
|
// src/cubing/twisty/model/props/puzzle/state/AlgProp.ts
|
|
2297
2308
|
var AlgIssues = class {
|
|
2298
2309
|
constructor(issues) {
|
|
@@ -2358,326 +2369,128 @@ var AlgProp = class extends TwistyPropSource {
|
|
|
2358
2369
|
}
|
|
2359
2370
|
};
|
|
2360
2371
|
|
|
2361
|
-
// src/cubing/twisty/model/props/
|
|
2362
|
-
var
|
|
2363
|
-
|
|
2364
|
-
return
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2367
|
-
|
|
2368
|
-
// src/cubing/twisty/model/props/viewer/BackViewProp.ts
|
|
2369
|
-
var backViewLayouts = {
|
|
2370
|
-
"none": true,
|
|
2371
|
-
"side-by-side": true,
|
|
2372
|
-
"top-right": true
|
|
2373
|
-
};
|
|
2374
|
-
var BackViewProp = class extends SimpleTwistyPropSource {
|
|
2375
|
-
getDefaultValue() {
|
|
2376
|
-
return "auto";
|
|
2377
|
-
}
|
|
2378
|
-
};
|
|
2379
|
-
|
|
2380
|
-
// src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts
|
|
2381
|
-
var IndexerConstructorRequestProp = class extends SimpleTwistyPropSource {
|
|
2382
|
-
getDefaultValue() {
|
|
2383
|
-
return "auto";
|
|
2372
|
+
// src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts
|
|
2373
|
+
var AlgTransformationProp = class extends TwistyPropDerived {
|
|
2374
|
+
derive(input) {
|
|
2375
|
+
return input.kpuzzle.algToTransformation(input.setupAlg.alg);
|
|
2384
2376
|
}
|
|
2385
2377
|
};
|
|
2386
2378
|
|
|
2387
|
-
// src/cubing/twisty/model/props/
|
|
2388
|
-
var
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2379
|
+
// src/cubing/twisty/model/props/puzzle/state/AnchorTransformationProp.ts
|
|
2380
|
+
var AnchorTransformationProp = class extends TwistyPropDerived {
|
|
2381
|
+
derive(inputs) {
|
|
2382
|
+
if (inputs.setupTransformation) {
|
|
2383
|
+
return inputs.setupTransformation;
|
|
2384
|
+
}
|
|
2385
|
+
switch (inputs.setupAnchor) {
|
|
2386
|
+
case "start":
|
|
2387
|
+
return inputs.setupAlgTransformation;
|
|
2388
|
+
case "end": {
|
|
2389
|
+
const algTransformation = inputs.indexer.transformationAtIndex(inputs.indexer.numAnimatedLeaves());
|
|
2390
|
+
const inverseAlgTransformation = algTransformation.invert();
|
|
2391
|
+
return inputs.setupAlgTransformation.applyTransformation(inverseAlgTransformation);
|
|
2392
|
+
}
|
|
2393
|
+
default:
|
|
2394
|
+
throw new Error("Unimplemented!");
|
|
2395
|
+
}
|
|
2392
2396
|
}
|
|
2393
2397
|
};
|
|
2394
2398
|
|
|
2395
|
-
// src/cubing/twisty/model/props/
|
|
2396
|
-
|
|
2397
|
-
return c1.latitude === c2.latitude && c1.longitude === c2.longitude && c1.distance === c2.distance;
|
|
2398
|
-
}
|
|
2399
|
-
var OrbitCoordinatesRequestProp = class extends TwistyPropSource {
|
|
2399
|
+
// src/cubing/twisty/model/props/puzzle/state/CatchUpMoveProp.ts
|
|
2400
|
+
var CatchUpMoveProp = class extends SimpleTwistyPropSource {
|
|
2400
2401
|
getDefaultValue() {
|
|
2401
|
-
return
|
|
2402
|
+
return { move: null, amount: 0 };
|
|
2402
2403
|
}
|
|
2403
2404
|
canReuseValue(v1, v2) {
|
|
2404
|
-
return v1 === v2
|
|
2405
|
-
}
|
|
2406
|
-
async derive(newCoordinates, oldValuePromise) {
|
|
2407
|
-
if (newCoordinates === "auto") {
|
|
2408
|
-
return "auto";
|
|
2409
|
-
}
|
|
2410
|
-
let oldValue = await oldValuePromise;
|
|
2411
|
-
if (oldValue === "auto") {
|
|
2412
|
-
oldValue = {};
|
|
2413
|
-
}
|
|
2414
|
-
const newValue = Object.assign({}, oldValue);
|
|
2415
|
-
Object.assign(newValue, newCoordinates);
|
|
2416
|
-
if (typeof newValue.latitude !== "undefined") {
|
|
2417
|
-
newValue.latitude = Math.min(Math.max(newValue.latitude, -90), 90);
|
|
2418
|
-
}
|
|
2419
|
-
if (typeof newValue.longitude !== "undefined") {
|
|
2420
|
-
newValue.longitude = mod(newValue.longitude, 360, 180);
|
|
2421
|
-
}
|
|
2422
|
-
return newValue;
|
|
2405
|
+
return v1.move === v2.move && v1.amount === v2.amount;
|
|
2423
2406
|
}
|
|
2424
2407
|
};
|
|
2425
2408
|
|
|
2426
|
-
// src/cubing/twisty/model/props/
|
|
2427
|
-
var
|
|
2428
|
-
|
|
2409
|
+
// src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts
|
|
2410
|
+
var CurrentLeavesSimplifiedProp = class extends TwistyPropDerived {
|
|
2411
|
+
derive(inputs) {
|
|
2429
2412
|
return {
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
loop: false
|
|
2413
|
+
stateIndex: inputs.currentMoveInfo.stateIndex,
|
|
2414
|
+
movesFinishing: inputs.currentMoveInfo.movesFinishing.map((currentMoveInfo) => currentMoveInfo.move),
|
|
2415
|
+
movesFinished: inputs.currentMoveInfo.movesFinished.map((currentMoveInfo) => currentMoveInfo.move)
|
|
2434
2416
|
};
|
|
2435
2417
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
const newValue = Object.assign({}, oldValue);
|
|
2439
|
-
Object.assign(newValue, newInfo);
|
|
2440
|
-
return newValue;
|
|
2441
|
-
}
|
|
2442
|
-
canReuseValue(v1, v2) {
|
|
2443
|
-
return v1.direction === v2.direction && v1.playing === v2.playing && v1.untilBoundary === v2.untilBoundary && v1.loop === v2.loop;
|
|
2444
|
-
}
|
|
2445
|
-
};
|
|
2446
|
-
|
|
2447
|
-
// src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts
|
|
2448
|
-
var PGPuzzleDescriptionStringProp = class extends SimpleTwistyPropSource {
|
|
2449
|
-
getDefaultValue() {
|
|
2450
|
-
return NO_VALUE;
|
|
2451
|
-
}
|
|
2452
|
-
};
|
|
2453
|
-
|
|
2454
|
-
// src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts
|
|
2455
|
-
var PuzzleIDRequestProp = class extends SimpleTwistyPropSource {
|
|
2456
|
-
getDefaultValue() {
|
|
2457
|
-
return NO_VALUE;
|
|
2418
|
+
canReuse(v1, v2) {
|
|
2419
|
+
return v1.stateIndex === v2.stateIndex && arrayEqualsCompare(v1.movesFinishing, v2.movesFinishing, (m1, m2) => m1.isIdentical(m2)) && arrayEqualsCompare(v1.movesFinished, v2.movesFinished, (m1, m2) => m1.isIdentical(m2));
|
|
2458
2420
|
}
|
|
2459
2421
|
};
|
|
2460
2422
|
|
|
2461
|
-
// src/cubing/twisty/model/props/puzzle/
|
|
2462
|
-
var
|
|
2423
|
+
// src/cubing/twisty/model/props/puzzle/state/CurrentMoveInfoProp.ts
|
|
2424
|
+
var CurrentMoveInfoProp = class extends TwistyPropDerived {
|
|
2463
2425
|
derive(inputs) {
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2426
|
+
function addCatchUpMove(currentMoveInfo) {
|
|
2427
|
+
if (inputs.detailedTimelineInfo.atEnd && inputs.catchUpMove.move !== null) {
|
|
2428
|
+
currentMoveInfo.currentMoves.push({
|
|
2429
|
+
move: inputs.catchUpMove.move,
|
|
2430
|
+
direction: -1 /* Backwards */,
|
|
2431
|
+
fraction: 1 - inputs.catchUpMove.amount,
|
|
2432
|
+
startTimestamp: -1,
|
|
2433
|
+
endTimestamp: -1
|
|
2469
2434
|
});
|
|
2470
2435
|
}
|
|
2471
|
-
return
|
|
2472
|
-
}
|
|
2473
|
-
if (inputs.puzzleDescriptionRequest && inputs.puzzleDescriptionRequest !== NO_VALUE) {
|
|
2474
|
-
return customPGPuzzleLoader(inputs.puzzleDescriptionRequest);
|
|
2475
|
-
}
|
|
2476
|
-
return cube3x3x3;
|
|
2477
|
-
}
|
|
2478
|
-
};
|
|
2479
|
-
|
|
2480
|
-
// src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts
|
|
2481
|
-
var SetupAnchorProp = class extends SimpleTwistyPropSource {
|
|
2482
|
-
getDefaultValue() {
|
|
2483
|
-
return "start";
|
|
2484
|
-
}
|
|
2485
|
-
};
|
|
2486
|
-
|
|
2487
|
-
// src/cubing/twisty/model/props/timeline/TempoScaleProp.ts
|
|
2488
|
-
var TempoScaleProp = class extends TwistyPropSource {
|
|
2489
|
-
getDefaultValue() {
|
|
2490
|
-
return 1;
|
|
2491
|
-
}
|
|
2492
|
-
derive(v) {
|
|
2493
|
-
return v < 0 ? 1 : v;
|
|
2494
|
-
}
|
|
2495
|
-
};
|
|
2496
|
-
|
|
2497
|
-
// src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts
|
|
2498
|
-
var smartTimestamps = {
|
|
2499
|
-
"start": true,
|
|
2500
|
-
"end": true,
|
|
2501
|
-
"anchor": true,
|
|
2502
|
-
"opposite-anchor": true
|
|
2503
|
-
};
|
|
2504
|
-
var TimestampRequestProp = class extends SimpleTwistyPropSource {
|
|
2505
|
-
getDefaultValue() {
|
|
2506
|
-
return "opposite-anchor";
|
|
2507
|
-
}
|
|
2508
|
-
set(v) {
|
|
2509
|
-
if (!this.validInput(v)) {
|
|
2510
|
-
return;
|
|
2511
|
-
}
|
|
2512
|
-
super.set(v);
|
|
2513
|
-
}
|
|
2514
|
-
validInput(v) {
|
|
2515
|
-
if (typeof v === "number") {
|
|
2516
|
-
return true;
|
|
2517
|
-
}
|
|
2518
|
-
if (smartTimestamps[v]) {
|
|
2519
|
-
return true;
|
|
2520
|
-
}
|
|
2521
|
-
return false;
|
|
2522
|
-
}
|
|
2523
|
-
};
|
|
2524
|
-
|
|
2525
|
-
// src/cubing/twisty/model/props/general/URLProp.ts
|
|
2526
|
-
var URLProp = class extends TwistyPropSource {
|
|
2527
|
-
getDefaultValue() {
|
|
2528
|
-
return null;
|
|
2529
|
-
}
|
|
2530
|
-
derive(input) {
|
|
2531
|
-
if (typeof input === "string") {
|
|
2532
|
-
return new URL(input, location.href);
|
|
2533
|
-
}
|
|
2534
|
-
return input;
|
|
2535
|
-
}
|
|
2536
|
-
};
|
|
2537
|
-
|
|
2538
|
-
// src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts
|
|
2539
|
-
var ViewerLinkProp = class extends SimpleTwistyPropSource {
|
|
2540
|
-
getDefaultValue() {
|
|
2541
|
-
return "auto";
|
|
2542
|
-
}
|
|
2543
|
-
};
|
|
2544
|
-
|
|
2545
|
-
// src/cubing/twisty/model/props/viewer/VisualizationProp.ts
|
|
2546
|
-
var VisualizationFormatProp = class extends SimpleTwistyPropSource {
|
|
2547
|
-
getDefaultValue() {
|
|
2548
|
-
return "auto";
|
|
2549
|
-
}
|
|
2550
|
-
};
|
|
2551
|
-
|
|
2552
|
-
// src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts
|
|
2553
|
-
var OrbitCoordinatesProp = class extends TwistyPropDerived {
|
|
2554
|
-
canReuseValue(v1, v2) {
|
|
2555
|
-
return orbitCoordinatesEqual(v1, v2);
|
|
2556
|
-
}
|
|
2557
|
-
async derive(inputs) {
|
|
2558
|
-
if (inputs.orbitCoordinatesRequest === "auto") {
|
|
2559
|
-
return defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy);
|
|
2560
|
-
}
|
|
2561
|
-
const req = Object.assign(Object.assign({}, defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy), inputs.orbitCoordinatesRequest));
|
|
2562
|
-
if (Math.abs(req.latitude) <= inputs.latitudeLimit) {
|
|
2563
|
-
return req;
|
|
2564
|
-
} else {
|
|
2565
|
-
const { latitude, longitude, distance } = req;
|
|
2566
|
-
return {
|
|
2567
|
-
latitude: inputs.latitudeLimit * Math.sign(latitude),
|
|
2568
|
-
longitude,
|
|
2569
|
-
distance
|
|
2570
|
-
};
|
|
2436
|
+
return currentMoveInfo;
|
|
2571
2437
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
var centeredCameraOrbitCoordinates = {
|
|
2575
|
-
latitude: 31.717474411461005,
|
|
2576
|
-
longitude: 0,
|
|
2577
|
-
distance: 5.877852522924731
|
|
2578
|
-
};
|
|
2579
|
-
var cubeCube3DCameraOrbitCoordinates = {
|
|
2580
|
-
latitude: 35,
|
|
2581
|
-
longitude: 30,
|
|
2582
|
-
distance: 6
|
|
2583
|
-
};
|
|
2584
|
-
var cubePG3DCameraOrbitCoordinates = {
|
|
2585
|
-
latitude: 35,
|
|
2586
|
-
longitude: 30,
|
|
2587
|
-
distance: 6.25
|
|
2588
|
-
};
|
|
2589
|
-
var megaminxCameraOrbitCoordinates = {
|
|
2590
|
-
latitude: Math.atan(1 / 2) * DEGREES_PER_RADIAN,
|
|
2591
|
-
longitude: 0,
|
|
2592
|
-
distance: 6.7
|
|
2593
|
-
};
|
|
2594
|
-
var pyraminxCameraOrbitCoordinates = {
|
|
2595
|
-
latitude: 26.56505117707799,
|
|
2596
|
-
longitude: 0,
|
|
2597
|
-
distance: 6
|
|
2598
|
-
};
|
|
2599
|
-
function defaultCameraOrbitCoordinates(puzzleID, strategy) {
|
|
2600
|
-
if (puzzleID[1] === "x") {
|
|
2601
|
-
if (strategy === "Cube3D") {
|
|
2602
|
-
return cubeCube3DCameraOrbitCoordinates;
|
|
2438
|
+
if (inputs.indexer.currentMoveInfo) {
|
|
2439
|
+
return addCatchUpMove(inputs.indexer.currentMoveInfo(inputs.detailedTimelineInfo.timestamp));
|
|
2603
2440
|
} else {
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
return pyraminxCameraOrbitCoordinates;
|
|
2614
|
-
case "skewb":
|
|
2615
|
-
return cubePG3DCameraOrbitCoordinates;
|
|
2616
|
-
default:
|
|
2617
|
-
return centeredCameraOrbitCoordinates;
|
|
2618
|
-
}
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
// src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts
|
|
2623
|
-
var PuzzleIDProp = class extends TwistyPropDerived {
|
|
2624
|
-
async derive(inputs) {
|
|
2625
|
-
return inputs.puzzleLoader.id;
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
|
|
2629
|
-
// src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts
|
|
2630
|
-
var cachedLoader = null;
|
|
2631
|
-
async function loader() {
|
|
2632
|
-
return cachedLoader ?? (cachedLoader = new (await THREEJS).TextureLoader());
|
|
2633
|
-
}
|
|
2634
|
-
var SpriteProp = class extends TwistyPropDerived {
|
|
2635
|
-
async derive(inputs) {
|
|
2636
|
-
const { spriteURL: textureURL } = inputs;
|
|
2637
|
-
if (textureURL === null) {
|
|
2638
|
-
return null;
|
|
2639
|
-
}
|
|
2640
|
-
return new Promise(async (resolve, _reject) => {
|
|
2641
|
-
const onLoadingError = () => {
|
|
2642
|
-
console.warn("Could not load sprite:", textureURL.toString());
|
|
2643
|
-
resolve(null);
|
|
2441
|
+
const idx = inputs.indexer.timestampToIndex(inputs.detailedTimelineInfo.timestamp);
|
|
2442
|
+
const currentMoveInfo = {
|
|
2443
|
+
stateIndex: idx,
|
|
2444
|
+
currentMoves: [],
|
|
2445
|
+
movesFinishing: [],
|
|
2446
|
+
movesFinished: [],
|
|
2447
|
+
movesStarting: [],
|
|
2448
|
+
latestStart: -Infinity,
|
|
2449
|
+
earliestEnd: Infinity
|
|
2644
2450
|
};
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2451
|
+
if (inputs.indexer.numAnimatedLeaves() > 0) {
|
|
2452
|
+
const move = inputs.indexer.getAnimLeaf(idx)?.as(Move);
|
|
2453
|
+
if (!move) {
|
|
2454
|
+
return addCatchUpMove(currentMoveInfo);
|
|
2455
|
+
}
|
|
2456
|
+
const start = inputs.indexer.indexToMoveStartTimestamp(idx);
|
|
2457
|
+
const duration = inputs.indexer.moveDuration(idx);
|
|
2458
|
+
const fraction = (inputs.detailedTimelineInfo.timestamp - start) / duration;
|
|
2459
|
+
const end = start + duration;
|
|
2460
|
+
const currentMove = {
|
|
2461
|
+
move,
|
|
2462
|
+
direction: 1 /* Forwards */,
|
|
2463
|
+
fraction,
|
|
2464
|
+
startTimestamp: start,
|
|
2465
|
+
endTimestamp: end
|
|
2466
|
+
};
|
|
2467
|
+
if (fraction === 0) {
|
|
2468
|
+
currentMoveInfo.movesStarting.push(currentMove);
|
|
2469
|
+
} else if (fraction === 1) {
|
|
2470
|
+
currentMoveInfo.movesFinishing.push(currentMove);
|
|
2471
|
+
} else {
|
|
2472
|
+
currentMoveInfo.currentMoves.push(currentMove);
|
|
2473
|
+
currentMoveInfo.latestStart = Math.max(currentMoveInfo.latestStart, start);
|
|
2474
|
+
currentMoveInfo.earliestEnd = Math.min(currentMoveInfo.earliestEnd, end);
|
|
2475
|
+
}
|
|
2649
2476
|
}
|
|
2650
|
-
|
|
2477
|
+
return addCatchUpMove(currentMoveInfo);
|
|
2478
|
+
}
|
|
2651
2479
|
}
|
|
2652
2480
|
};
|
|
2653
2481
|
|
|
2654
|
-
// src/cubing/twisty/model/props/
|
|
2655
|
-
var
|
|
2482
|
+
// src/cubing/twisty/model/props/puzzle/state/CurrentStateProp.ts
|
|
2483
|
+
var CurrentStateProp = class extends TwistyPropDerived {
|
|
2656
2484
|
derive(inputs) {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
case "auto":
|
|
2665
|
-
case "3D":
|
|
2666
|
-
return "Cube3D";
|
|
2667
|
-
default:
|
|
2668
|
-
return inputs.visualizationRequest;
|
|
2669
|
-
}
|
|
2670
|
-
default:
|
|
2671
|
-
switch (inputs.visualizationRequest) {
|
|
2672
|
-
case "auto":
|
|
2673
|
-
case "3D":
|
|
2674
|
-
return "PG3D";
|
|
2675
|
-
case "experimental-2D-LL":
|
|
2676
|
-
return "2D";
|
|
2677
|
-
default:
|
|
2678
|
-
return inputs.visualizationRequest;
|
|
2679
|
-
}
|
|
2485
|
+
let transformation = inputs.indexer.transformationAtIndex(inputs.currentLeavesSimplified.stateIndex);
|
|
2486
|
+
transformation = inputs.anchoredStart.applyTransformation(transformation);
|
|
2487
|
+
for (const finishingMove of inputs.currentLeavesSimplified.movesFinishing) {
|
|
2488
|
+
transformation = transformation.applyMove(finishingMove);
|
|
2489
|
+
}
|
|
2490
|
+
for (const finishedMove of inputs.currentLeavesSimplified.movesFinished) {
|
|
2491
|
+
transformation = transformation.applyMove(finishedMove);
|
|
2680
2492
|
}
|
|
2493
|
+
return transformation.toKState();
|
|
2681
2494
|
}
|
|
2682
2495
|
};
|
|
2683
2496
|
|
|
@@ -3026,7 +2839,7 @@ var SimultaneousMoveIndexer = class {
|
|
|
3026
2839
|
}
|
|
3027
2840
|
const currentMove = {
|
|
3028
2841
|
move,
|
|
3029
|
-
direction:
|
|
2842
|
+
direction: 1 /* Forwards */,
|
|
3030
2843
|
fraction,
|
|
3031
2844
|
startTimestamp: leafWithRange.start,
|
|
3032
2845
|
endTimestamp: leafWithRange.end
|
|
@@ -3232,7 +3045,7 @@ var AlgWalker = class extends TraversalDownUp {
|
|
|
3232
3045
|
return false;
|
|
3233
3046
|
}
|
|
3234
3047
|
let i = wd.back ? alg.experimentalNumUnits() - 1 : 0;
|
|
3235
|
-
for (const unit of directedGenerator(alg.units(), wd.back ?
|
|
3048
|
+
for (const unit of directedGenerator(alg.units(), wd.back ? -1 /* Backwards */ : 1 /* Forwards */)) {
|
|
3236
3049
|
if (this.traverseUnit(unit, new WalkerDown(wd.apd.children[i], wd.back))) {
|
|
3237
3050
|
return true;
|
|
3238
3051
|
}
|
|
@@ -3463,6 +3276,40 @@ var IndexerConstructorProp = class extends TwistyPropDerived {
|
|
|
3463
3276
|
}
|
|
3464
3277
|
};
|
|
3465
3278
|
|
|
3279
|
+
// src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts
|
|
3280
|
+
var IndexerConstructorRequestProp = class extends SimpleTwistyPropSource {
|
|
3281
|
+
getDefaultValue() {
|
|
3282
|
+
return "auto";
|
|
3283
|
+
}
|
|
3284
|
+
};
|
|
3285
|
+
|
|
3286
|
+
// src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts
|
|
3287
|
+
var IndexerProp = class extends TwistyPropDerived {
|
|
3288
|
+
derive(input) {
|
|
3289
|
+
return new input.indexerConstructor(input.kpuzzle, input.algWithIssues.alg);
|
|
3290
|
+
}
|
|
3291
|
+
};
|
|
3292
|
+
|
|
3293
|
+
// src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts
|
|
3294
|
+
var LegacyPositionProp = class extends TwistyPropDerived {
|
|
3295
|
+
derive(inputs) {
|
|
3296
|
+
return {
|
|
3297
|
+
state: inputs.state,
|
|
3298
|
+
movesInProgress: inputs.currentMoveInfo.currentMoves
|
|
3299
|
+
};
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
|
|
3303
|
+
// src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts
|
|
3304
|
+
var NaiveMoveCountProp = class extends TwistyPropDerived {
|
|
3305
|
+
derive(inputs) {
|
|
3306
|
+
if (inputs.alg.issues.errors.length > 0) {
|
|
3307
|
+
return null;
|
|
3308
|
+
}
|
|
3309
|
+
return countMoves(inputs.alg.alg);
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
|
|
3466
3313
|
// src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts
|
|
3467
3314
|
var validate = true;
|
|
3468
3315
|
var PuzzleAlgProp = class extends TwistyPropDerived {
|
|
@@ -3483,48 +3330,79 @@ var PuzzleAlgProp = class extends TwistyPropDerived {
|
|
|
3483
3330
|
}
|
|
3484
3331
|
};
|
|
3485
3332
|
|
|
3486
|
-
// src/cubing/twisty/model/props/puzzle/state/
|
|
3487
|
-
var
|
|
3488
|
-
|
|
3489
|
-
return
|
|
3333
|
+
// src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts
|
|
3334
|
+
var SetupAnchorProp = class extends SimpleTwistyPropSource {
|
|
3335
|
+
getDefaultValue() {
|
|
3336
|
+
return "start";
|
|
3490
3337
|
}
|
|
3491
3338
|
};
|
|
3492
3339
|
|
|
3493
|
-
// src/cubing/twisty/model/props/puzzle/state/
|
|
3494
|
-
var
|
|
3495
|
-
|
|
3496
|
-
return
|
|
3340
|
+
// src/cubing/twisty/model/props/puzzle/state/SetupTransformationProp.ts
|
|
3341
|
+
var SetupTransformationProp = class extends SimpleTwistyPropSource {
|
|
3342
|
+
getDefaultValue() {
|
|
3343
|
+
return null;
|
|
3497
3344
|
}
|
|
3498
3345
|
};
|
|
3499
3346
|
|
|
3500
|
-
// src/cubing/twisty/model/props/puzzle/
|
|
3501
|
-
var
|
|
3347
|
+
// src/cubing/twisty/model/props/puzzle/structure/KPuzzleProp.ts
|
|
3348
|
+
var KPuzzleProp = class extends TwistyPropDerived {
|
|
3349
|
+
async derive(inputs) {
|
|
3350
|
+
return inputs.puzzleLoader.kpuzzle();
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
|
|
3354
|
+
// src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts
|
|
3355
|
+
var PGPuzzleDescriptionStringProp = class extends SimpleTwistyPropSource {
|
|
3356
|
+
getDefaultValue() {
|
|
3357
|
+
return NO_VALUE;
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
|
|
3361
|
+
// src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts
|
|
3362
|
+
var PuzzleIDProp = class extends TwistyPropDerived {
|
|
3363
|
+
async derive(inputs) {
|
|
3364
|
+
return inputs.puzzleLoader.id;
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
|
|
3368
|
+
// src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts
|
|
3369
|
+
var PuzzleIDRequestProp = class extends SimpleTwistyPropSource {
|
|
3370
|
+
getDefaultValue() {
|
|
3371
|
+
return NO_VALUE;
|
|
3372
|
+
}
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3375
|
+
// src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts
|
|
3376
|
+
var PuzzleLoaderProp = class extends TwistyPropDerived {
|
|
3502
3377
|
derive(inputs) {
|
|
3503
|
-
if (inputs.
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
case "end": {
|
|
3510
|
-
const algTransformation = inputs.indexer.transformationAtIndex(inputs.indexer.numAnimatedLeaves());
|
|
3511
|
-
const inverseAlgTransformation = algTransformation.invert();
|
|
3512
|
-
return inputs.setupAlgTransformation.applyTransformation(inverseAlgTransformation);
|
|
3378
|
+
if (inputs.puzzleIDRequest && inputs.puzzleIDRequest !== NO_VALUE) {
|
|
3379
|
+
const puzzleLoader = puzzles[inputs.puzzleIDRequest];
|
|
3380
|
+
if (!puzzleLoader) {
|
|
3381
|
+
this.userVisibleErrorTracker.set({
|
|
3382
|
+
errors: [`Invalid puzzle ID: ${inputs.puzzleIDRequest}`]
|
|
3383
|
+
});
|
|
3513
3384
|
}
|
|
3514
|
-
|
|
3515
|
-
|
|
3385
|
+
return puzzleLoader;
|
|
3386
|
+
}
|
|
3387
|
+
if (inputs.puzzleDescriptionRequest && inputs.puzzleDescriptionRequest !== NO_VALUE) {
|
|
3388
|
+
return customPGPuzzleLoader(inputs.puzzleDescriptionRequest);
|
|
3516
3389
|
}
|
|
3390
|
+
return cube3x3x3;
|
|
3517
3391
|
}
|
|
3518
3392
|
};
|
|
3519
3393
|
|
|
3520
|
-
// src/cubing/twisty/model/props/
|
|
3521
|
-
var
|
|
3394
|
+
// src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts
|
|
3395
|
+
var CoarseTimelineInfoProp = class extends TwistyPropDerived {
|
|
3522
3396
|
derive(inputs) {
|
|
3523
3397
|
return {
|
|
3524
|
-
|
|
3525
|
-
|
|
3398
|
+
playing: inputs.playingInfo.playing,
|
|
3399
|
+
atStart: inputs.detailedTimelineInfo.atStart,
|
|
3400
|
+
atEnd: inputs.detailedTimelineInfo.atEnd
|
|
3526
3401
|
};
|
|
3527
3402
|
}
|
|
3403
|
+
canReuseValue(v1, v2) {
|
|
3404
|
+
return v1.playing === v2.playing && v1.atStart === v2.atStart && v1.atEnd === v2.atEnd;
|
|
3405
|
+
}
|
|
3528
3406
|
};
|
|
3529
3407
|
|
|
3530
3408
|
// src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts
|
|
@@ -3573,156 +3451,161 @@ requestedTimestampToMilliseconds_fn = function(inputs) {
|
|
|
3573
3451
|
}
|
|
3574
3452
|
};
|
|
3575
3453
|
|
|
3576
|
-
// src/cubing/twisty/model/props/timeline/
|
|
3577
|
-
var
|
|
3578
|
-
|
|
3454
|
+
// src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts
|
|
3455
|
+
var PlayingInfoProp = class extends TwistyPropSource {
|
|
3456
|
+
async getDefaultValue() {
|
|
3579
3457
|
return {
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3458
|
+
direction: 1 /* Forwards */,
|
|
3459
|
+
playing: false,
|
|
3460
|
+
untilBoundary: "entire-timeline" /* EntireTimeline */,
|
|
3461
|
+
loop: false
|
|
3583
3462
|
};
|
|
3584
3463
|
}
|
|
3464
|
+
async derive(newInfo, oldValuePromise) {
|
|
3465
|
+
const oldValue = await oldValuePromise;
|
|
3466
|
+
const newValue = Object.assign({}, oldValue);
|
|
3467
|
+
Object.assign(newValue, newInfo);
|
|
3468
|
+
return newValue;
|
|
3469
|
+
}
|
|
3585
3470
|
canReuseValue(v1, v2) {
|
|
3586
|
-
return v1.playing === v2.playing && v1.
|
|
3471
|
+
return v1.direction === v2.direction && v1.playing === v2.playing && v1.untilBoundary === v2.untilBoundary && v1.loop === v2.loop;
|
|
3587
3472
|
}
|
|
3588
3473
|
};
|
|
3589
3474
|
|
|
3590
|
-
// src/cubing/twisty/model/props/
|
|
3591
|
-
var
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
direction: Direction.Backwards,
|
|
3598
|
-
fraction: 1 - inputs.catchUpMove.amount,
|
|
3599
|
-
startTimestamp: -1,
|
|
3600
|
-
endTimestamp: -1
|
|
3601
|
-
});
|
|
3602
|
-
}
|
|
3603
|
-
return currentMoveInfo;
|
|
3604
|
-
}
|
|
3605
|
-
if (inputs.indexer.currentMoveInfo) {
|
|
3606
|
-
return addCatchUpMove(inputs.indexer.currentMoveInfo(inputs.detailedTimelineInfo.timestamp));
|
|
3607
|
-
} else {
|
|
3608
|
-
const idx = inputs.indexer.timestampToIndex(inputs.detailedTimelineInfo.timestamp);
|
|
3609
|
-
const currentMoveInfo = {
|
|
3610
|
-
stateIndex: idx,
|
|
3611
|
-
currentMoves: [],
|
|
3612
|
-
movesFinishing: [],
|
|
3613
|
-
movesFinished: [],
|
|
3614
|
-
movesStarting: [],
|
|
3615
|
-
latestStart: -Infinity,
|
|
3616
|
-
earliestEnd: Infinity
|
|
3617
|
-
};
|
|
3618
|
-
if (inputs.indexer.numAnimatedLeaves() > 0) {
|
|
3619
|
-
const move = inputs.indexer.getAnimLeaf(idx)?.as(Move);
|
|
3620
|
-
if (!move) {
|
|
3621
|
-
return addCatchUpMove(currentMoveInfo);
|
|
3622
|
-
}
|
|
3623
|
-
const start = inputs.indexer.indexToMoveStartTimestamp(idx);
|
|
3624
|
-
const duration = inputs.indexer.moveDuration(idx);
|
|
3625
|
-
const fraction = (inputs.detailedTimelineInfo.timestamp - start) / duration;
|
|
3626
|
-
const end = start + duration;
|
|
3627
|
-
const currentMove = {
|
|
3628
|
-
move,
|
|
3629
|
-
direction: Direction.Forwards,
|
|
3630
|
-
fraction,
|
|
3631
|
-
startTimestamp: start,
|
|
3632
|
-
endTimestamp: end
|
|
3633
|
-
};
|
|
3634
|
-
if (fraction === 0) {
|
|
3635
|
-
currentMoveInfo.movesStarting.push(currentMove);
|
|
3636
|
-
} else if (fraction === 1) {
|
|
3637
|
-
currentMoveInfo.movesFinishing.push(currentMove);
|
|
3638
|
-
} else {
|
|
3639
|
-
currentMoveInfo.currentMoves.push(currentMove);
|
|
3640
|
-
currentMoveInfo.latestStart = Math.max(currentMoveInfo.latestStart, start);
|
|
3641
|
-
currentMoveInfo.earliestEnd = Math.min(currentMoveInfo.earliestEnd, end);
|
|
3642
|
-
}
|
|
3643
|
-
}
|
|
3644
|
-
return addCatchUpMove(currentMoveInfo);
|
|
3645
|
-
}
|
|
3475
|
+
// src/cubing/twisty/model/props/timeline/TempoScaleProp.ts
|
|
3476
|
+
var TempoScaleProp = class extends TwistyPropSource {
|
|
3477
|
+
getDefaultValue() {
|
|
3478
|
+
return 1;
|
|
3479
|
+
}
|
|
3480
|
+
derive(v) {
|
|
3481
|
+
return v < 0 ? 1 : v;
|
|
3646
3482
|
}
|
|
3647
3483
|
};
|
|
3648
3484
|
|
|
3649
|
-
// src/cubing/twisty/model/props/
|
|
3650
|
-
var
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3485
|
+
// src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts
|
|
3486
|
+
var smartTimestamps = {
|
|
3487
|
+
"start": true,
|
|
3488
|
+
"end": true,
|
|
3489
|
+
"anchor": true,
|
|
3490
|
+
"opposite-anchor": true
|
|
3491
|
+
};
|
|
3492
|
+
var TimestampRequestProp = class extends SimpleTwistyPropSource {
|
|
3493
|
+
getDefaultValue() {
|
|
3494
|
+
return "opposite-anchor";
|
|
3657
3495
|
}
|
|
3658
|
-
|
|
3659
|
-
|
|
3496
|
+
set(v) {
|
|
3497
|
+
if (!this.validInput(v)) {
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
super.set(v);
|
|
3660
3501
|
}
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
var CurrentStateProp = class extends TwistyPropDerived {
|
|
3665
|
-
derive(inputs) {
|
|
3666
|
-
let transformation = inputs.indexer.transformationAtIndex(inputs.currentLeavesSimplified.stateIndex);
|
|
3667
|
-
transformation = inputs.anchoredStart.applyTransformation(transformation);
|
|
3668
|
-
for (const finishingMove of inputs.currentLeavesSimplified.movesFinishing) {
|
|
3669
|
-
transformation = transformation.applyMove(finishingMove);
|
|
3502
|
+
validInput(v) {
|
|
3503
|
+
if (typeof v === "number") {
|
|
3504
|
+
return true;
|
|
3670
3505
|
}
|
|
3671
|
-
|
|
3672
|
-
|
|
3506
|
+
if (smartTimestamps[v]) {
|
|
3507
|
+
return true;
|
|
3673
3508
|
}
|
|
3674
|
-
return
|
|
3509
|
+
return false;
|
|
3675
3510
|
}
|
|
3676
3511
|
};
|
|
3677
3512
|
|
|
3678
|
-
// src/cubing/twisty/model/props/
|
|
3679
|
-
var
|
|
3513
|
+
// src/cubing/twisty/model/props/viewer/BackViewProp.ts
|
|
3514
|
+
var backViewLayouts = {
|
|
3515
|
+
"none": true,
|
|
3516
|
+
"side-by-side": true,
|
|
3517
|
+
"top-right": true
|
|
3518
|
+
};
|
|
3519
|
+
var BackViewProp = class extends SimpleTwistyPropSource {
|
|
3520
|
+
getDefaultValue() {
|
|
3521
|
+
return "auto";
|
|
3522
|
+
}
|
|
3523
|
+
};
|
|
3524
|
+
|
|
3525
|
+
// src/cubing/twisty/model/props/viewer/TimeRangeProp.ts
|
|
3526
|
+
var TimeRangeProp = class extends TwistyPropDerived {
|
|
3680
3527
|
derive(inputs) {
|
|
3681
3528
|
return {
|
|
3682
|
-
|
|
3683
|
-
|
|
3529
|
+
start: 0,
|
|
3530
|
+
end: inputs.indexer.algDuration()
|
|
3684
3531
|
};
|
|
3685
3532
|
}
|
|
3686
3533
|
};
|
|
3687
3534
|
|
|
3688
|
-
// src/cubing/twisty/model/props/
|
|
3689
|
-
var
|
|
3690
|
-
|
|
3691
|
-
return
|
|
3535
|
+
// src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts
|
|
3536
|
+
var ViewerLinkProp = class extends SimpleTwistyPropSource {
|
|
3537
|
+
getDefaultValue() {
|
|
3538
|
+
return "auto";
|
|
3692
3539
|
}
|
|
3693
3540
|
};
|
|
3694
3541
|
|
|
3695
|
-
// src/cubing/twisty/model/
|
|
3696
|
-
var
|
|
3697
|
-
var UserVisibleErrorTracker = class extends SimpleTwistyPropSource {
|
|
3542
|
+
// src/cubing/twisty/model/props/viewer/VisualizationProp.ts
|
|
3543
|
+
var VisualizationFormatProp = class extends SimpleTwistyPropSource {
|
|
3698
3544
|
getDefaultValue() {
|
|
3699
|
-
return
|
|
3700
|
-
}
|
|
3701
|
-
reset() {
|
|
3702
|
-
this.set(this.getDefaultValue());
|
|
3545
|
+
return "auto";
|
|
3703
3546
|
}
|
|
3704
|
-
|
|
3705
|
-
|
|
3547
|
+
};
|
|
3548
|
+
|
|
3549
|
+
// src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts
|
|
3550
|
+
var VisualizationStrategyProp = class extends TwistyPropDerived {
|
|
3551
|
+
derive(inputs) {
|
|
3552
|
+
switch (inputs.puzzleID) {
|
|
3553
|
+
case "clock":
|
|
3554
|
+
case "square1":
|
|
3555
|
+
case "kilominx":
|
|
3556
|
+
case "redi_cube":
|
|
3557
|
+
return "2D";
|
|
3558
|
+
case "3x3x3":
|
|
3559
|
+
switch (inputs.visualizationRequest) {
|
|
3560
|
+
case "auto":
|
|
3561
|
+
case "3D":
|
|
3562
|
+
return "Cube3D";
|
|
3563
|
+
default:
|
|
3564
|
+
return inputs.visualizationRequest;
|
|
3565
|
+
}
|
|
3566
|
+
default:
|
|
3567
|
+
switch (inputs.visualizationRequest) {
|
|
3568
|
+
case "auto":
|
|
3569
|
+
case "3D":
|
|
3570
|
+
return "PG3D";
|
|
3571
|
+
case "experimental-2D-LL":
|
|
3572
|
+
return "2D";
|
|
3573
|
+
default:
|
|
3574
|
+
return inputs.visualizationRequest;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3706
3577
|
}
|
|
3707
3578
|
};
|
|
3708
3579
|
|
|
3709
|
-
// src/cubing/twisty/model/props/puzzle/
|
|
3710
|
-
var
|
|
3580
|
+
// src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts
|
|
3581
|
+
var FoundationDisplayProp = class extends SimpleTwistyPropSource {
|
|
3711
3582
|
getDefaultValue() {
|
|
3712
|
-
return
|
|
3713
|
-
}
|
|
3714
|
-
canReuseValue(v1, v2) {
|
|
3715
|
-
return v1.move === v2.move && v1.amount === v2.amount;
|
|
3583
|
+
return "auto";
|
|
3716
3584
|
}
|
|
3717
3585
|
};
|
|
3718
3586
|
|
|
3719
|
-
// src/cubing/twisty/model/props/puzzle/
|
|
3720
|
-
var
|
|
3721
|
-
|
|
3722
|
-
|
|
3587
|
+
// src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts
|
|
3588
|
+
var cachedLoader = null;
|
|
3589
|
+
async function loader() {
|
|
3590
|
+
return cachedLoader ?? (cachedLoader = new (await THREEJS).TextureLoader());
|
|
3591
|
+
}
|
|
3592
|
+
var SpriteProp = class extends TwistyPropDerived {
|
|
3593
|
+
async derive(inputs) {
|
|
3594
|
+
const { spriteURL: textureURL } = inputs;
|
|
3595
|
+
if (textureURL === null) {
|
|
3723
3596
|
return null;
|
|
3724
3597
|
}
|
|
3725
|
-
return
|
|
3598
|
+
return new Promise(async (resolve, _reject) => {
|
|
3599
|
+
const onLoadingError = () => {
|
|
3600
|
+
console.warn("Could not load sprite:", textureURL.toString());
|
|
3601
|
+
resolve(null);
|
|
3602
|
+
};
|
|
3603
|
+
try {
|
|
3604
|
+
(await loader()).load(textureURL.toString(), resolve, onLoadingError, onLoadingError);
|
|
3605
|
+
} catch (e) {
|
|
3606
|
+
onLoadingError();
|
|
3607
|
+
}
|
|
3608
|
+
});
|
|
3726
3609
|
}
|
|
3727
3610
|
};
|
|
3728
3611
|
|
|
@@ -3733,24 +3616,161 @@ var MovePressInputProp = class extends SimpleTwistyPropSource {
|
|
|
3733
3616
|
}
|
|
3734
3617
|
};
|
|
3735
3618
|
|
|
3736
|
-
// src/cubing/twisty/model/props/
|
|
3737
|
-
var
|
|
3619
|
+
// src/cubing/twisty/model/props/viewer/BackgroundProp.ts
|
|
3620
|
+
var BackgroundProp = class extends SimpleTwistyPropSource {
|
|
3738
3621
|
getDefaultValue() {
|
|
3739
3622
|
return "auto";
|
|
3740
3623
|
}
|
|
3741
3624
|
};
|
|
3742
3625
|
|
|
3743
|
-
// src/cubing/twisty/model/props/
|
|
3744
|
-
var
|
|
3626
|
+
// src/cubing/twisty/model/props/viewer/LatitudeLimit.ts
|
|
3627
|
+
var DEFAULT_LATITUDE_LIMIT = 35;
|
|
3628
|
+
var LatitudeLimitProp = class extends SimpleTwistyPropSource {
|
|
3745
3629
|
getDefaultValue() {
|
|
3746
|
-
return
|
|
3630
|
+
return DEFAULT_LATITUDE_LIMIT;
|
|
3747
3631
|
}
|
|
3748
3632
|
};
|
|
3749
3633
|
|
|
3750
|
-
// src/cubing/twisty/model/props/
|
|
3751
|
-
|
|
3634
|
+
// src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts
|
|
3635
|
+
function orbitCoordinatesEqual(c1, c2) {
|
|
3636
|
+
return c1.latitude === c2.latitude && c1.longitude === c2.longitude && c1.distance === c2.distance;
|
|
3637
|
+
}
|
|
3638
|
+
var OrbitCoordinatesRequestProp = class extends TwistyPropSource {
|
|
3752
3639
|
getDefaultValue() {
|
|
3753
|
-
return
|
|
3640
|
+
return "auto";
|
|
3641
|
+
}
|
|
3642
|
+
canReuseValue(v1, v2) {
|
|
3643
|
+
return v1 === v2 || orbitCoordinatesEqual(v1, v2);
|
|
3644
|
+
}
|
|
3645
|
+
async derive(newCoordinates, oldValuePromise) {
|
|
3646
|
+
if (newCoordinates === "auto") {
|
|
3647
|
+
return "auto";
|
|
3648
|
+
}
|
|
3649
|
+
let oldValue = await oldValuePromise;
|
|
3650
|
+
if (oldValue === "auto") {
|
|
3651
|
+
oldValue = {};
|
|
3652
|
+
}
|
|
3653
|
+
const newValue = Object.assign({}, oldValue);
|
|
3654
|
+
Object.assign(newValue, newCoordinates);
|
|
3655
|
+
if (typeof newValue.latitude !== "undefined") {
|
|
3656
|
+
newValue.latitude = Math.min(Math.max(newValue.latitude, -90), 90);
|
|
3657
|
+
}
|
|
3658
|
+
if (typeof newValue.longitude !== "undefined") {
|
|
3659
|
+
newValue.longitude = mod(newValue.longitude, 360, 180);
|
|
3660
|
+
}
|
|
3661
|
+
return newValue;
|
|
3662
|
+
}
|
|
3663
|
+
};
|
|
3664
|
+
|
|
3665
|
+
// src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts
|
|
3666
|
+
var OrbitCoordinatesProp = class extends TwistyPropDerived {
|
|
3667
|
+
canReuseValue(v1, v2) {
|
|
3668
|
+
return orbitCoordinatesEqual(v1, v2);
|
|
3669
|
+
}
|
|
3670
|
+
async derive(inputs) {
|
|
3671
|
+
if (inputs.orbitCoordinatesRequest === "auto") {
|
|
3672
|
+
return defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy);
|
|
3673
|
+
}
|
|
3674
|
+
const req = Object.assign(Object.assign({}, defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy), inputs.orbitCoordinatesRequest));
|
|
3675
|
+
if (Math.abs(req.latitude) <= inputs.latitudeLimit) {
|
|
3676
|
+
return req;
|
|
3677
|
+
} else {
|
|
3678
|
+
const { latitude, longitude, distance } = req;
|
|
3679
|
+
return {
|
|
3680
|
+
latitude: inputs.latitudeLimit * Math.sign(latitude),
|
|
3681
|
+
longitude,
|
|
3682
|
+
distance
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
};
|
|
3687
|
+
var centeredCameraOrbitCoordinates = {
|
|
3688
|
+
latitude: 31.717474411461005,
|
|
3689
|
+
longitude: 0,
|
|
3690
|
+
distance: 5.877852522924731
|
|
3691
|
+
};
|
|
3692
|
+
var cubeCube3DCameraOrbitCoordinates = {
|
|
3693
|
+
latitude: 35,
|
|
3694
|
+
longitude: 30,
|
|
3695
|
+
distance: 6
|
|
3696
|
+
};
|
|
3697
|
+
var cubePG3DCameraOrbitCoordinates = {
|
|
3698
|
+
latitude: 35,
|
|
3699
|
+
longitude: 30,
|
|
3700
|
+
distance: 6.25
|
|
3701
|
+
};
|
|
3702
|
+
var megaminxCameraOrbitCoordinates = {
|
|
3703
|
+
latitude: Math.atan(1 / 2) * DEGREES_PER_RADIAN,
|
|
3704
|
+
longitude: 0,
|
|
3705
|
+
distance: 6.7
|
|
3706
|
+
};
|
|
3707
|
+
var pyraminxCameraOrbitCoordinates = {
|
|
3708
|
+
latitude: 26.56505117707799,
|
|
3709
|
+
longitude: 0,
|
|
3710
|
+
distance: 6
|
|
3711
|
+
};
|
|
3712
|
+
function defaultCameraOrbitCoordinates(puzzleID, strategy) {
|
|
3713
|
+
if (puzzleID[1] === "x") {
|
|
3714
|
+
if (strategy === "Cube3D") {
|
|
3715
|
+
return cubeCube3DCameraOrbitCoordinates;
|
|
3716
|
+
} else {
|
|
3717
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
3718
|
+
}
|
|
3719
|
+
} else {
|
|
3720
|
+
switch (puzzleID) {
|
|
3721
|
+
case "megaminx":
|
|
3722
|
+
case "gigaminx":
|
|
3723
|
+
return megaminxCameraOrbitCoordinates;
|
|
3724
|
+
case "pyraminx":
|
|
3725
|
+
case "master_tetraminx":
|
|
3726
|
+
return pyraminxCameraOrbitCoordinates;
|
|
3727
|
+
case "skewb":
|
|
3728
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
3729
|
+
default:
|
|
3730
|
+
return centeredCameraOrbitCoordinates;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
// src/cubing/twisty/model/TwistySceneModel.ts
|
|
3736
|
+
var TwistySceneModel = class {
|
|
3737
|
+
constructor(twistyPlayerModel) {
|
|
3738
|
+
this.twistyPlayerModel = twistyPlayerModel;
|
|
3739
|
+
this.background = new BackgroundProp();
|
|
3740
|
+
this.foundationDisplay = new FoundationDisplayProp();
|
|
3741
|
+
this.foundationStickerSpriteURL = new URLProp();
|
|
3742
|
+
this.hintFacelet = new HintFaceletProp();
|
|
3743
|
+
this.hintStickerSpriteURL = new URLProp();
|
|
3744
|
+
this.latitudeLimit = new LatitudeLimitProp();
|
|
3745
|
+
this.movePressInput = new MovePressInputProp();
|
|
3746
|
+
this.orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
|
|
3747
|
+
this.stickering = new StickeringProp();
|
|
3748
|
+
this.foundationStickerSprite = new SpriteProp({
|
|
3749
|
+
spriteURL: this.foundationStickerSpriteURL
|
|
3750
|
+
});
|
|
3751
|
+
this.hintStickerSprite = new SpriteProp({
|
|
3752
|
+
spriteURL: this.hintStickerSpriteURL
|
|
3753
|
+
});
|
|
3754
|
+
this.orbitCoordinates = new OrbitCoordinatesProp({
|
|
3755
|
+
orbitCoordinatesRequest: this.orbitCoordinatesRequest,
|
|
3756
|
+
latitudeLimit: this.latitudeLimit,
|
|
3757
|
+
puzzleID: twistyPlayerModel.puzzleID,
|
|
3758
|
+
strategy: twistyPlayerModel.visualizationStrategy
|
|
3759
|
+
});
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
|
|
3763
|
+
// src/cubing/twisty/model/UserVisibleErrorTracker.ts
|
|
3764
|
+
var EMPTY_ERRORS = { errors: [] };
|
|
3765
|
+
var UserVisibleErrorTracker = class extends SimpleTwistyPropSource {
|
|
3766
|
+
getDefaultValue() {
|
|
3767
|
+
return EMPTY_ERRORS;
|
|
3768
|
+
}
|
|
3769
|
+
reset() {
|
|
3770
|
+
this.set(this.getDefaultValue());
|
|
3771
|
+
}
|
|
3772
|
+
canReuseValue(_v1, _v2) {
|
|
3773
|
+
return arrayEquals(_v1.errors, _v2.errors);
|
|
3754
3774
|
}
|
|
3755
3775
|
};
|
|
3756
3776
|
|
|
@@ -3759,25 +3779,16 @@ var TwistyPlayerModel = class {
|
|
|
3759
3779
|
constructor() {
|
|
3760
3780
|
this.userVisibleErrorTracker = new UserVisibleErrorTracker();
|
|
3761
3781
|
this.alg = new AlgProp();
|
|
3762
|
-
this.background = new BackgroundProp();
|
|
3763
3782
|
this.backView = new BackViewProp();
|
|
3764
3783
|
this.controlPanel = new ControlPanelProp();
|
|
3765
3784
|
this.catchUpMove = new CatchUpMoveProp();
|
|
3766
|
-
this.foundationDisplay = new FoundationDisplayProp();
|
|
3767
|
-
this.foundationStickerSpriteURL = new URLProp();
|
|
3768
|
-
this.hintFacelet = new HintFaceletProp();
|
|
3769
|
-
this.hintStickerSpriteURL = new URLProp();
|
|
3770
3785
|
this.indexerConstructorRequest = new IndexerConstructorRequestProp();
|
|
3771
|
-
this.latitudeLimit = new LatitudeLimitProp();
|
|
3772
|
-
this.movePressInput = new MovePressInputProp();
|
|
3773
|
-
this.orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
|
|
3774
3786
|
this.playingInfo = new PlayingInfoProp();
|
|
3775
3787
|
this.puzzleDescriptionRequest = new PGPuzzleDescriptionStringProp();
|
|
3776
3788
|
this.puzzleIDRequest = new PuzzleIDRequestProp();
|
|
3777
3789
|
this.setupAnchor = new SetupAnchorProp();
|
|
3778
3790
|
this.setupAlg = new AlgProp();
|
|
3779
3791
|
this.setupTransformation = new SetupTransformationProp();
|
|
3780
|
-
this.stickering = new StickeringProp();
|
|
3781
3792
|
this.tempoScale = new TempoScaleProp();
|
|
3782
3793
|
this.timestampRequest = new TimestampRequestProp();
|
|
3783
3794
|
this.viewerLink = new ViewerLinkProp();
|
|
@@ -3785,12 +3796,6 @@ var TwistyPlayerModel = class {
|
|
|
3785
3796
|
this.title = new ArbitraryStringProp();
|
|
3786
3797
|
this.videoURL = new URLProp();
|
|
3787
3798
|
this.competitionID = new ArbitraryStringProp();
|
|
3788
|
-
this.foundationStickerSprite = new SpriteProp({
|
|
3789
|
-
spriteURL: this.foundationStickerSpriteURL
|
|
3790
|
-
});
|
|
3791
|
-
this.hintStickerSprite = new SpriteProp({
|
|
3792
|
-
spriteURL: this.hintStickerSpriteURL
|
|
3793
|
-
});
|
|
3794
3799
|
this.puzzleLoader = new PuzzleLoaderProp({
|
|
3795
3800
|
puzzleIDRequest: this.puzzleIDRequest,
|
|
3796
3801
|
puzzleDescriptionRequest: this.puzzleDescriptionRequest
|
|
@@ -3816,12 +3821,6 @@ var TwistyPlayerModel = class {
|
|
|
3816
3821
|
indexerConstructorRequest: this.indexerConstructorRequest
|
|
3817
3822
|
});
|
|
3818
3823
|
this.moveCount = new NaiveMoveCountProp({ alg: this.puzzleAlg });
|
|
3819
|
-
this.orbitCoordinates = new OrbitCoordinatesProp({
|
|
3820
|
-
orbitCoordinatesRequest: this.orbitCoordinatesRequest,
|
|
3821
|
-
latitudeLimit: this.latitudeLimit,
|
|
3822
|
-
puzzleID: this.puzzleID,
|
|
3823
|
-
strategy: this.visualizationStrategy
|
|
3824
|
-
});
|
|
3825
3824
|
this.setupAlgTransformation = new AlgTransformationProp({
|
|
3826
3825
|
setupAlg: this.puzzleSetupAlg,
|
|
3827
3826
|
kpuzzle: this.kpuzzle
|
|
@@ -3870,6 +3869,7 @@ var TwistyPlayerModel = class {
|
|
|
3870
3869
|
currentMoveInfo: this.currentMoveInfo,
|
|
3871
3870
|
state: this.currentState
|
|
3872
3871
|
});
|
|
3872
|
+
this.twistySceneModel = new TwistySceneModel(this);
|
|
3873
3873
|
}
|
|
3874
3874
|
async twizzleLink() {
|
|
3875
3875
|
const [
|
|
@@ -3887,7 +3887,7 @@ var TwistyPlayerModel = class {
|
|
|
3887
3887
|
this.alg.get(),
|
|
3888
3888
|
this.setupAlg.get(),
|
|
3889
3889
|
this.setupAnchor.get(),
|
|
3890
|
-
this.stickering.get()
|
|
3890
|
+
this.twistySceneModel.stickering.get()
|
|
3891
3891
|
]);
|
|
3892
3892
|
const isExplorer = viewerLink === "experimental-twizzle-explorer";
|
|
3893
3893
|
console.log({ isExplorer, viewerLink });
|
|
@@ -3980,13 +3980,13 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
3980
3980
|
throw err("timestamp");
|
|
3981
3981
|
}
|
|
3982
3982
|
set hintFacelets(hintFaceletStyle) {
|
|
3983
|
-
this.experimentalModel.hintFacelet.set(hintFaceletStyle);
|
|
3983
|
+
this.experimentalModel.twistySceneModel.hintFacelet.set(hintFaceletStyle);
|
|
3984
3984
|
}
|
|
3985
3985
|
get hintFacelets() {
|
|
3986
3986
|
throw err("hintFacelets");
|
|
3987
3987
|
}
|
|
3988
3988
|
set experimentalStickering(stickering) {
|
|
3989
|
-
this.experimentalModel.stickering.set(stickering);
|
|
3989
|
+
this.experimentalModel.twistySceneModel.stickering.set(stickering);
|
|
3990
3990
|
}
|
|
3991
3991
|
get experimentalStickering() {
|
|
3992
3992
|
throw err("stickering");
|
|
@@ -3998,7 +3998,7 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
3998
3998
|
throw err("backView");
|
|
3999
3999
|
}
|
|
4000
4000
|
set background(backgroundTheme) {
|
|
4001
|
-
this.experimentalModel.background.set(backgroundTheme);
|
|
4001
|
+
this.experimentalModel.twistySceneModel.background.set(backgroundTheme);
|
|
4002
4002
|
}
|
|
4003
4003
|
get background() {
|
|
4004
4004
|
throw err("background");
|
|
@@ -4040,31 +4040,31 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
4040
4040
|
throw err("viewerLink");
|
|
4041
4041
|
}
|
|
4042
4042
|
set experimentalMovePressInput(movePressInput) {
|
|
4043
|
-
this.experimentalModel.movePressInput.set(movePressInput);
|
|
4043
|
+
this.experimentalModel.twistySceneModel.movePressInput.set(movePressInput);
|
|
4044
4044
|
}
|
|
4045
4045
|
get experimentalMovePressInput() {
|
|
4046
4046
|
throw err("experimentalMovePressInput");
|
|
4047
4047
|
}
|
|
4048
4048
|
set cameraLatitude(latitude) {
|
|
4049
|
-
this.experimentalModel.orbitCoordinatesRequest.set({ latitude });
|
|
4049
|
+
this.experimentalModel.twistySceneModel.orbitCoordinatesRequest.set({ latitude });
|
|
4050
4050
|
}
|
|
4051
4051
|
get cameraLatitude() {
|
|
4052
4052
|
throw err("cameraLatitude");
|
|
4053
4053
|
}
|
|
4054
4054
|
set cameraLongitude(longitude) {
|
|
4055
|
-
this.experimentalModel.orbitCoordinatesRequest.set({ longitude });
|
|
4055
|
+
this.experimentalModel.twistySceneModel.orbitCoordinatesRequest.set({ longitude });
|
|
4056
4056
|
}
|
|
4057
4057
|
get cameraLongitude() {
|
|
4058
4058
|
throw err("cameraLongitude");
|
|
4059
4059
|
}
|
|
4060
4060
|
set cameraDistance(distance) {
|
|
4061
|
-
this.experimentalModel.orbitCoordinatesRequest.set({ distance });
|
|
4061
|
+
this.experimentalModel.twistySceneModel.orbitCoordinatesRequest.set({ distance });
|
|
4062
4062
|
}
|
|
4063
4063
|
get cameraDistance() {
|
|
4064
4064
|
throw err("cameraDistance");
|
|
4065
4065
|
}
|
|
4066
4066
|
set cameraLatitudeLimit(latitudeLimit) {
|
|
4067
|
-
this.experimentalModel.latitudeLimit.set(latitudeLimit);
|
|
4067
|
+
this.experimentalModel.twistySceneModel.latitudeLimit.set(latitudeLimit);
|
|
4068
4068
|
}
|
|
4069
4069
|
get cameraLatitudeLimit() {
|
|
4070
4070
|
throw err("cameraLatitudeLimit");
|
|
@@ -4082,13 +4082,13 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
4082
4082
|
throw err("tempoScale");
|
|
4083
4083
|
}
|
|
4084
4084
|
set experimentalSprite(url) {
|
|
4085
|
-
this.experimentalModel.foundationStickerSpriteURL.set(url);
|
|
4085
|
+
this.experimentalModel.twistySceneModel.foundationStickerSpriteURL.set(url);
|
|
4086
4086
|
}
|
|
4087
4087
|
get experimentalSprite() {
|
|
4088
4088
|
throw err("experimentalSprite");
|
|
4089
4089
|
}
|
|
4090
4090
|
set experimentalHintSprite(url) {
|
|
4091
|
-
this.experimentalModel.hintStickerSpriteURL.set(url);
|
|
4091
|
+
this.experimentalModel.twistySceneModel.hintStickerSpriteURL.set(url);
|
|
4092
4092
|
}
|
|
4093
4093
|
get experimentalHintSprite() {
|
|
4094
4094
|
throw err("experimentalHintSprite");
|
|
@@ -4113,6 +4113,7 @@ var ExperimentalGetters = class {
|
|
|
4113
4113
|
};
|
|
4114
4114
|
|
|
4115
4115
|
// src/cubing/twisty/views/TwistyPlayer.ts
|
|
4116
|
+
var DATA_ATTRIBUTE_PREFIX = "data-";
|
|
4116
4117
|
var twistyPlayerAttributeMap = {
|
|
4117
4118
|
"alg": "alg",
|
|
4118
4119
|
"experimental-setup-alg": "experimentalSetupAlg",
|
|
@@ -4181,7 +4182,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
4181
4182
|
this.contentWrapper.appendChild(scrubber);
|
|
4182
4183
|
this.buttons = new TwistyButtons(this.experimentalModel, this.controller, this);
|
|
4183
4184
|
this.contentWrapper.appendChild(this.buttons);
|
|
4184
|
-
this.experimentalModel.background.addFreshListener((backgroundTheme) => {
|
|
4185
|
+
this.experimentalModel.twistySceneModel.background.addFreshListener((backgroundTheme) => {
|
|
4185
4186
|
this.contentWrapper.classList.toggle("checkered", backgroundTheme !== "none");
|
|
4186
4187
|
});
|
|
4187
4188
|
this.experimentalModel.controlPanel.addFreshListener((controlPanel) => {
|
|
@@ -4234,9 +4235,16 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
4234
4235
|
this.experimentalModel.experimentalAddMove(flexibleMove, options);
|
|
4235
4236
|
}
|
|
4236
4237
|
static get observedAttributes() {
|
|
4237
|
-
|
|
4238
|
+
const observed = [];
|
|
4239
|
+
for (const key of Object.keys(twistyPlayerAttributeMap)) {
|
|
4240
|
+
observed.push(key, DATA_ATTRIBUTE_PREFIX + key);
|
|
4241
|
+
}
|
|
4242
|
+
return observed;
|
|
4238
4243
|
}
|
|
4239
4244
|
attributeChangedCallback(attributeName, _oldValue, newValue) {
|
|
4245
|
+
if (attributeName.startsWith("data-")) {
|
|
4246
|
+
attributeName = attributeName.slice("data-".length);
|
|
4247
|
+
}
|
|
4240
4248
|
const setterName = twistyPlayerAttributeMap[attributeName];
|
|
4241
4249
|
if (!setterName) {
|
|
4242
4250
|
return;
|
|
@@ -4273,7 +4281,7 @@ setVisualizationWrapper_fn = function(strategy) {
|
|
|
4273
4281
|
switch (strategy) {
|
|
4274
4282
|
case "2D":
|
|
4275
4283
|
case "experimental-2D-LL":
|
|
4276
|
-
newWrapper = new Twisty2DSceneWrapper(this.experimentalModel, strategy);
|
|
4284
|
+
newWrapper = new Twisty2DSceneWrapper(this.experimentalModel.twistySceneModel, strategy);
|
|
4277
4285
|
break;
|
|
4278
4286
|
case "Cube3D":
|
|
4279
4287
|
case "PG3D":
|
|
@@ -4356,7 +4364,7 @@ var TwistyAlgWrapperElem = class extends HTMLElementShim {
|
|
|
4356
4364
|
this.queue.push(dataUp.element);
|
|
4357
4365
|
return dataUp.moveCount;
|
|
4358
4366
|
}
|
|
4359
|
-
flushQueue(direction =
|
|
4367
|
+
flushQueue(direction = 1 /* Forwards */) {
|
|
4360
4368
|
for (const node of maybeReverseList(this.queue, direction)) {
|
|
4361
4369
|
this.append(node);
|
|
4362
4370
|
}
|
|
@@ -4368,13 +4376,13 @@ var TwistyAlgWrapperElem = class extends HTMLElementShim {
|
|
|
4368
4376
|
};
|
|
4369
4377
|
customElementsShim.define("twisty-alg-wrapper-elem", TwistyAlgWrapperElem);
|
|
4370
4378
|
function oppositeDirection(direction) {
|
|
4371
|
-
return direction ===
|
|
4379
|
+
return direction === 1 /* Forwards */ ? -1 /* Backwards */ : 1 /* Forwards */;
|
|
4372
4380
|
}
|
|
4373
4381
|
function updateDirectionByAmount(currentDirection, amount) {
|
|
4374
4382
|
return amount < 0 ? oppositeDirection(currentDirection) : currentDirection;
|
|
4375
4383
|
}
|
|
4376
4384
|
function maybeReverseList(l, direction) {
|
|
4377
|
-
if (direction ===
|
|
4385
|
+
if (direction === 1 /* Forwards */) {
|
|
4378
4386
|
return l;
|
|
4379
4387
|
}
|
|
4380
4388
|
const copy = Array.from(l);
|
|
@@ -4514,7 +4522,7 @@ var algToDOMTreeInstance = new AlgToDOMTree();
|
|
|
4514
4522
|
var algToDOMTree = algToDOMTreeInstance.traverseAlg.bind(algToDOMTreeInstance);
|
|
4515
4523
|
var MoveHighlighter = class {
|
|
4516
4524
|
constructor() {
|
|
4517
|
-
this.moveCharIndexMap = new Map();
|
|
4525
|
+
this.moveCharIndexMap = /* @__PURE__ */ new Map();
|
|
4518
4526
|
this.currentElem = null;
|
|
4519
4527
|
}
|
|
4520
4528
|
addMove(charIndex, elem) {
|
|
@@ -4550,7 +4558,7 @@ var TwistyAlgViewer = class extends HTMLElementShim {
|
|
|
4550
4558
|
__privateSet(this, _domTree, algToDOMTree(alg, {
|
|
4551
4559
|
earliestMoveIndex: 0,
|
|
4552
4560
|
twistyAlgViewer: this,
|
|
4553
|
-
direction:
|
|
4561
|
+
direction: 1 /* Forwards */
|
|
4554
4562
|
}).element);
|
|
4555
4563
|
this.textContent = "";
|
|
4556
4564
|
this.appendChild(__privateGet(this, _domTree));
|
|
@@ -5152,7 +5160,7 @@ var URLParamUpdater = class {
|
|
|
5152
5160
|
__privateSet(this, _prefix, options?.prefix ?? "");
|
|
5153
5161
|
this.listenToAlgProp(model.alg, "alg");
|
|
5154
5162
|
this.listenToAlgProp(model.setupAlg, "setup-alg");
|
|
5155
|
-
this.listenToStringSourceProp(model.stickering, "stickering");
|
|
5163
|
+
this.listenToStringSourceProp(model.twistySceneModel.stickering, "stickering");
|
|
5156
5164
|
this.listenToStringSourceProp(model.setupAnchor, "setup-anchor");
|
|
5157
5165
|
this.listenToStringOrNoValueProp(model.puzzleIDRequest, "puzzle", NO_VALUE);
|
|
5158
5166
|
this.listenToStringOrNoValueProp(model.puzzleDescriptionRequest, "puzzle-description", NO_VALUE);
|