bard-legends-framework 0.9.6 → 0.9.7
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/_interfaces/index.d.ts +2 -2
- package/dist/_interfaces/index.js +2 -3
- package/dist/game-entities/attachable/attachable.d.ts +6 -6
- package/dist/game-entities/attachable/attachable.js +28 -30
- package/dist/game-entities/attachable/attachable.spec.js +129 -128
- package/dist/game-entities/attachable/attachable.store.d.ts +5 -5
- package/dist/game-entities/attachable/attachable.store.js +34 -32
- package/dist/game-entities/attachable/attachable.test.js +132 -131
- package/dist/game-entities/attachable/destroyable.d.ts +13 -13
- package/dist/game-entities/attachable/destroyable.js +64 -69
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.js +125 -116
- package/dist/game-entities/attachable/helpers/referance-variable.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/referance-variable.js +47 -48
- package/dist/game-entities/attachable/interfaces.d.ts +6 -6
- package/dist/game-entities/attachable/interfaces.js +2 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +0 -1
- package/dist/game-entities/controller/controller.js +0 -1
- package/dist/game-entities/controller/controller.spec.js +128 -125
- package/dist/game-entities/entity/entity.spec.js +263 -293
- package/dist/game-entities/entity/helpers/view-creation.helper.d.ts +7 -7
- package/dist/game-entities/entity/helpers/view-creation.helper.js +48 -48
- package/dist/game-entities/scene/scene.spec.js +219 -223
- package/dist/game-entities/service/service.js +0 -4
- package/dist/game-entities/service/service.spec.js +265 -237
- package/dist/game-entities/service/service.test.js +4 -2
- package/dist/game-entities/update-loop.d.ts +18 -18
- package/dist/game-entities/update-loop.js +46 -28
- package/dist/game-entities/view/view.spec.js +490 -506
- package/dist/game-entities/view/view.test.js +1 -1
- package/dist/lib/animator/animations.d.ts +13 -13
- package/dist/lib/animator/animations.js +43 -40
- package/dist/lib/animator/animator.d.ts +41 -41
- package/dist/lib/animator/animator.js +194 -197
- package/dist/lib/animator/animator.spec.js +699 -612
- package/dist/lib/animator/index.js +24 -19
- package/dist/lib/libraries/animator/animations.d.ts +13 -13
- package/dist/lib/libraries/animator/animations.js +43 -40
- package/dist/lib/libraries/animator/animator.d.ts +41 -41
- package/dist/lib/libraries/animator/animator.js +194 -197
- package/dist/lib/libraries/animator/animator.spec.js +699 -612
- package/dist/lib/libraries/animator/index.js +24 -19
- package/dist/lib/libraries/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/libraries/path-finder/path-finder.js +19 -20
- package/dist/lib/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/path-finder/path-finder.js +19 -20
- package/dist/lib/services/keyboard/keyboard.d.ts +4 -4
- package/dist/lib/services/keyboard/keyboard.js +39 -31
- package/dist/lib/services/mouse/mouse.service.d.ts +8 -8
- package/dist/lib/services/mouse/mouse.service.js +65 -53
- package/dist/lib/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/lib/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/lib/update-loop.d.ts +10 -10
- package/dist/lib/update-loop.js +35 -27
- package/dist/physics/entitity-types/immovable-physics-entity.d.ts +6 -6
- package/dist/physics/entitity-types/immovable-physics-entity.js +23 -24
- package/dist/physics/entitity-types/movable-entity.d.ts +6 -6
- package/dist/physics/entitity-types/movable-entity.js +21 -22
- package/dist/physics/entitity-types/movable-physics-entity.d.ts +14 -14
- package/dist/physics/entitity-types/movable-physics-entity.js +83 -88
- package/dist/physics/entitity-types/physics-entity.d.ts +23 -23
- package/dist/physics/entitity-types/physics-entity.js +97 -88
- package/dist/physics/helpers/closest-available-space.helper.d.ts +16 -16
- package/dist/physics/helpers/closest-available-space.helper.js +98 -96
- package/dist/physics/helpers/closest-available-space.helper.spec.js +115 -68
- package/dist/physics/helpers/p2js.helper.d.ts +3 -3
- package/dist/physics/helpers/p2js.helper.js +21 -22
- package/dist/physics/helpers/shape-factory.d.ts +9 -4
- package/dist/physics/helpers/shape-factory.js +99 -75
- package/dist/physics/libs/p2js.helper.js +1 -1
- package/dist/physics/libs/position-to-grid-position-converter.d.ts +3 -3
- package/dist/physics/libs/position-to-grid-position-converter.js +15 -13
- package/dist/physics/module//360/237/223/220services/availability-grid.service.d.ts +10 -5
- package/dist/physics/module//360/237/223/220services/availability-grid.service.js +77 -57
- package/dist/physics/module//360/237/223/220services/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/border.service.js +57 -37
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/collisions.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/collisions.service.js +110 -98
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.d.ts +28 -6
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.js +121 -89
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/materials.service.d.ts +16 -11
- package/dist/physics/module//360/237/223/220services/materials.service.js +118 -108
- package/dist/physics/module//360/237/223/220services/path-finder.service.d.ts +19 -8
- package/dist/physics/module//360/237/223/220services/path-finder.service.js +121 -82
- package/dist/physics/module//360/237/223/220services/physics-world.service.d.ts +30 -15
- package/dist/physics/module//360/237/223/220services/physics-world.service.js +122 -100
- package/dist/physics/module//360/237/223/220services/ray-casting.service.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/ray-casting.service.js +87 -86
- package/dist/physics/module//360/237/223/220services/shape-creation.service.d.ts +9 -4
- package/dist/physics/module//360/237/223/220services/shape-creation.service.js +113 -84
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +2 -1
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.d.ts +8 -8
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js +32 -33
- package/dist/physics/physics-world.d.ts +50 -34
- package/dist/physics/physics-world.js +142 -133
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.d.ts +3 -3
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js +15 -13
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.d.ts +9 -9
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js +82 -77
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.d.ts +18 -14
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js +91 -79
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.d.ts +11 -11
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js +84 -76
- package/dist/physics/sub-elements/collisions/physics-collision.d.ts +7 -7
- package/dist/physics/sub-elements/collisions/physics-collision.js +43 -44
- package/dist/physics/sub-elements/elements/physics-body-groups.d.ts +11 -11
- package/dist/physics/sub-elements/elements/physics-body-groups.js +54 -54
- package/dist/physics/sub-elements/elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/elements/physics-world-borders.d.ts +3 -3
- package/dist/physics/sub-elements/elements/physics-world-borders.js +69 -45
- package/dist/physics/sub-elements/physics-body-groups.d.ts +8 -8
- package/dist/physics/sub-elements/physics-body-groups.js +41 -42
- package/dist/physics/sub-elements/physics-collision.d.ts +16 -16
- package/dist/physics/sub-elements/physics-collision.js +141 -121
- package/dist/physics/sub-elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/physics-world-borders.d.ts +2 -2
- package/dist/physics/sub-elements/physics-world-borders.js +25 -26
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.d.ts +15 -11
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js +59 -59
- package/dist/physics/sub-elements/raycasting/physics-explosion.d.ts +13 -6
- package/dist/physics/sub-elements/raycasting/physics-explosion.js +108 -73
- package/dist/physics/sub-elements/raycasting/ray-cast.d.ts +19 -19
- package/dist/physics/sub-elements/raycasting/ray-cast.js +93 -98
- package/dist/pixi/display-object/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/components/filters.js +106 -81
- package/dist/pixi/display-object/components/glow-effect.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-effect.js +33 -36
- package/dist/pixi/display-object/components/glow-filter.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-filter.js +33 -36
- package/dist/pixi/display-object/container-attributes.js +1 -1
- package/dist/pixi/display-object/display-object-attributes.d.ts +41 -41
- package/dist/pixi/display-object/display-object-attributes.js +148 -150
- package/dist/pixi/display-object/display-object.d.ts +17 -17
- package/dist/pixi/display-object/display-object.js +79 -75
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js +89 -77
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +30 -30
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.js +62 -53
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js +93 -81
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.d.ts +12 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js +120 -109
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +32 -32
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.js +92 -85
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +28 -28
- package/dist/pixi/display-object/filters/templates/plane.template.js +20 -20
- package/dist/pixi/display-object/filters.js +20 -4
- package/dist/pixi/display-object/objects/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/objects/components/filters.js +106 -81
- package/dist/pixi/display-object/objects/container.d.ts +2 -2
- package/dist/pixi/display-object/objects/container.js +39 -30
- package/dist/pixi/display-object/objects/graphics.d.ts +28 -28
- package/dist/pixi/display-object/objects/graphics.js +218 -202
- package/dist/pixi/display-object/objects/helpers/filters.d.ts +25 -25
- package/dist/pixi/display-object/objects/helpers/filters.js +150 -124
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.d.ts +7 -7
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js +114 -95
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.d.ts +5 -5
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js +81 -57
- package/dist/pixi/display-object/objects/sprite.d.ts +43 -43
- package/dist/pixi/display-object/objects/sprite.js +248 -233
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +9 -9
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +1 -1
- package/dist/pixi/display-object/objects/text.d.ts +25 -25
- package/dist/pixi/display-object/objects/text.js +111 -102
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.d.ts +13 -9
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js +96 -67
- package/dist/pixi/game.d.ts +1 -1
- package/dist/pixi/game.js +2 -2
- package/dist/pixi/helpers/glow-sprite-generator.d.ts +6 -6
- package/dist/pixi/helpers/glow-sprite-generator.js +99 -84
- package/dist/pixi/helpers/pixi-container.helper.d.ts +1 -1
- package/dist/pixi/helpers/pixi-container.helper.js +10 -8
- package/dist/pixi/helpers/screen-position-to-stage.helper.d.ts +1 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.js +12 -12
- package/dist/pixi/helpers/screen-position-to-stage.helper.test.js +174 -79
- package/dist/pixi/modules/CAMERA/index.d.ts +1 -1
- package/dist/pixi/modules/CAMERA/index.js +3 -3
- package/dist/services/keyboard/keyboard.d.ts +4 -4
- package/dist/services/keyboard/keyboard.js +39 -31
- package/dist/services/mouse/mouse.service.d.ts +8 -8
- package/dist/services/mouse/mouse.service.js +65 -53
- package/dist/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/utilities/libraries/animator/animating-content/state-animation.d.ts +29 -26
- package/dist/utilities/libraries/animator/animating-content/state-animation.js +159 -165
- package/dist/utilities/libraries/animator/animating-content/state-animation.test.js +386 -375
- package/dist/utilities/libraries/animator/animator.spec.js +765 -656
- package/dist/utilities/libraries/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/grid/grid.d.ts +35 -31
- package/dist/utilities/libraries/data-structures/grid/grid.js +128 -117
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js +176 -138
- package/dist/utilities/libraries/data-structures/grid/grid.test.js +218 -141
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.d.ts +3 -3
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js +15 -13
- package/dist/utilities/libraries/data-structures/queue/queue.d.ts +21 -21
- package/dist/utilities/libraries/data-structures/queue/queue.js +63 -66
- package/dist/utilities/libraries/data-structures/queue/queue.test.js +54 -55
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +122 -68
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +140 -135
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +293 -229
- package/dist/utilities/libraries/path-finder/path-finder.d.ts +7 -7
- package/dist/utilities/libraries/path-finder/path-finder.js +113 -109
- package/dist/utilities/libraries/path-finder/path-finder.spec.js +131 -106
- package/dist/utilities/services/keyboard/keyboard.d.ts +4 -4
- package/dist/utilities/services/keyboard/keyboard.js +42 -34
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.d.ts +1 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.js +12 -12
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js +168 -73
- package/dist/utilities/services/mouse/mouse-target-focus.service.d.ts +15 -15
- package/dist/utilities/services/mouse/mouse-target-focus.service.js +79 -76
- package/dist/utilities/services/mouse/mouse.service.d.ts +9 -9
- package/dist/utilities/services/mouse/mouse.service.js +86 -72
- package/dist/utilities/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/utilities/services/mouse/mouser-target-focus.service.js +83 -81
- package/package.json +4 -10
|
@@ -1,258 +1,273 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var __createBinding =
|
|
2
|
+
(this && this.__createBinding) ||
|
|
3
|
+
(Object.create
|
|
4
|
+
? (o, m, k, k2) => {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: () => m[k] };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}
|
|
12
|
+
: (o, m, k, k2) => {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
});
|
|
16
|
+
var __setModuleDefault =
|
|
17
|
+
(this && this.__setModuleDefault) ||
|
|
18
|
+
(Object.create
|
|
19
|
+
? (o, v) => {
|
|
20
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
21
|
+
}
|
|
22
|
+
: (o, v) => {
|
|
23
|
+
o['default'] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar =
|
|
26
|
+
(this && this.__importStar) ||
|
|
27
|
+
(mod => {
|
|
19
28
|
if (mod && mod.__esModule) return mod;
|
|
20
29
|
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !==
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== 'default' && Object.hasOwn(mod, k)) __createBinding(result, mod, k);
|
|
22
31
|
__setModuleDefault(result, mod);
|
|
23
32
|
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports,
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
26
35
|
exports.Sprite = void 0;
|
|
27
|
-
const helpers_lib_1 = require(
|
|
28
|
-
const PIXI = __importStar(require(
|
|
29
|
-
const __1 = require(
|
|
30
|
-
const game_assets_1 = require(
|
|
31
|
-
const position_conversion_helper_1 = require(
|
|
32
|
-
const container_1 = require(
|
|
33
|
-
const graphics_1 = require(
|
|
34
|
-
const glow_sprite_generator_1 = require(
|
|
36
|
+
const helpers_lib_1 = require('helpers-lib');
|
|
37
|
+
const PIXI = __importStar(require('pixi.js'));
|
|
38
|
+
const __1 = require('../..');
|
|
39
|
+
const game_assets_1 = require('../../helpers/game-assets');
|
|
40
|
+
const position_conversion_helper_1 = require('../../helpers/position-conversion.helper');
|
|
41
|
+
const container_1 = require('../container');
|
|
42
|
+
const graphics_1 = require('./graphics');
|
|
43
|
+
const glow_sprite_generator_1 = require('./helpers/glow-sprite-generator');
|
|
35
44
|
class Sprite extends container_1.Container {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
let texture = __1.Game.instance.renderer.generateTexture(pixiContainer, {
|
|
45
|
-
resolution: 2,
|
|
46
|
-
scaleMode: PIXI.SCALE_MODES.LINEAR,
|
|
47
|
-
multisample: PIXI.MSAA_QUALITY.HIGH
|
|
48
|
-
});
|
|
49
|
-
if (parent) {
|
|
50
|
-
parent.addChild(pixiContainer); // TODO: removing and re-adding the child changes the order, it would break the z-index order
|
|
51
|
-
}
|
|
52
|
-
let assetId = game_assets_1.GameAssets.insertAsset(texture);
|
|
53
|
-
let spriteDefinition = {
|
|
54
|
-
id: assetId,
|
|
55
|
-
scale: container.scale,
|
|
56
|
-
size: container.size,
|
|
57
|
-
anchor: helpers_lib_1.Vector.zero,
|
|
58
|
-
boundingShapes: undefined,
|
|
59
|
-
destroyAssetOnDestroy: true
|
|
60
|
-
};
|
|
61
|
-
return new Sprite(spriteDefinition, { ignoreAnchor: true });
|
|
62
|
-
}
|
|
63
|
-
constructor(spriteDefinition, options = {}) {
|
|
64
|
-
super();
|
|
65
|
-
this._textureScale = 1;
|
|
66
|
-
if (!spriteDefinition) {
|
|
67
|
-
throw new Error(`Sprite: spriteDefinition cannot be nullish!`);
|
|
68
|
-
}
|
|
69
|
-
this.spriteDefinition = spriteDefinition;
|
|
70
|
-
this.pixiSprite = new PIXI.Sprite(game_assets_1.GameAssets.getAsset(spriteDefinition.id));
|
|
71
|
-
this.pixiContainer.addChild(this.pixiSprite);
|
|
72
|
-
this.setTextureScale(spriteDefinition.scale);
|
|
73
|
-
if (options.textureSize) {
|
|
74
|
-
this.pixiSprite.width = options.textureSize.x;
|
|
75
|
-
this.pixiSprite.height = options.textureSize.y;
|
|
76
|
-
}
|
|
77
|
-
if (options.texturePosition) {
|
|
78
|
-
this.pixiSprite.position.set(options.texturePosition.x, options.texturePosition.y);
|
|
79
|
-
}
|
|
80
|
-
if (!options.ignoreAnchor) {
|
|
81
|
-
this.pixiSprite.anchor.set(spriteDefinition.anchor.x, spriteDefinition.anchor.y);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
destroySelf() {
|
|
85
|
-
super.destroySelf();
|
|
86
|
-
!this.pixiGlowSprite?.destroyed && this.pixiGlowSprite?.destroy();
|
|
87
|
-
this.pixiGlowSprite = undefined;
|
|
88
|
-
this.mask?.destroy();
|
|
89
|
-
this.mask = undefined;
|
|
90
|
-
this.boundingShape?.destroy();
|
|
91
|
-
this.boundingShape = undefined;
|
|
92
|
-
if (this.spriteDefinition.destroyAssetOnDestroy) {
|
|
93
|
-
game_assets_1.GameAssets.destroyAsset(this.spriteDefinition.id);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
setTextureScale(value) {
|
|
97
|
-
this.textureScale = value;
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
|
-
get textureScale() {
|
|
101
|
-
return this._textureScale;
|
|
102
|
-
}
|
|
103
|
-
set textureScale(value) {
|
|
104
|
-
this._textureScale = value;
|
|
105
|
-
this.pixiSprite.scale.set(value);
|
|
106
|
-
}
|
|
107
|
-
get size() {
|
|
108
|
-
// pixiContainer size can be different because glow filter can increase the size of the sprite
|
|
109
|
-
return new helpers_lib_1.Vector(this.pixiSprite.width, this.pixiSprite.height);
|
|
110
|
-
}
|
|
111
|
-
getMask() {
|
|
112
|
-
return this.pixiSprite;
|
|
113
|
-
}
|
|
114
|
-
set interactive(value) {
|
|
115
|
-
super.interactive = value;
|
|
116
|
-
if (value && this.spriteDefinition.boundingShapes && !this.pixiContainer.hitArea) {
|
|
117
|
-
this.pixiContainer.hitArea = new position_conversion_helper_1.CompositeHitArea(this.spriteDefinition.boundingShapes, this.size, helpers_lib_1.Vector.fromVec2(this.spriteDefinition.anchor));
|
|
118
|
-
}
|
|
45
|
+
static createSnapshotSprite(container) {
|
|
46
|
+
const pixiContainer = container['pixiContainer'];
|
|
47
|
+
const parent = pixiContainer.parent;
|
|
48
|
+
// The "renderer.generateTexture" is not working if the sprite has a parent with the PIXI version 7.4.2
|
|
49
|
+
// TODO: Check if this is still the case with a newer version of PIXI
|
|
50
|
+
if (parent) {
|
|
51
|
+
parent.removeChild(pixiContainer);
|
|
119
52
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
53
|
+
const texture = __1.Game.instance.renderer.generateTexture(pixiContainer, {
|
|
54
|
+
resolution: 2,
|
|
55
|
+
scaleMode: PIXI.SCALE_MODES.LINEAR,
|
|
56
|
+
multisample: PIXI.MSAA_QUALITY.HIGH
|
|
57
|
+
});
|
|
58
|
+
if (parent) {
|
|
59
|
+
parent.addChild(pixiContainer); // TODO: removing and re-adding the child changes the order, it would break the z-index order
|
|
123
60
|
}
|
|
124
|
-
|
|
125
|
-
|
|
61
|
+
const assetId = game_assets_1.GameAssets.insertAsset(texture);
|
|
62
|
+
const spriteDefinition = {
|
|
63
|
+
id: assetId,
|
|
64
|
+
scale: container.scale,
|
|
65
|
+
size: container.size,
|
|
66
|
+
anchor: helpers_lib_1.Vector.zero,
|
|
67
|
+
boundingShapes: undefined,
|
|
68
|
+
destroyAssetOnDestroy: true
|
|
69
|
+
};
|
|
70
|
+
return new Sprite(spriteDefinition, { ignoreAnchor: true });
|
|
71
|
+
}
|
|
72
|
+
constructor(spriteDefinition, options = {}) {
|
|
73
|
+
super();
|
|
74
|
+
this._textureScale = 1;
|
|
75
|
+
if (!spriteDefinition) {
|
|
76
|
+
throw new Error(`Sprite: spriteDefinition cannot be nullish!`);
|
|
126
77
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
setBlendMode(value) {
|
|
136
|
-
this.blendMode = value;
|
|
137
|
-
return this;
|
|
138
|
-
}
|
|
139
|
-
get blendMode() {
|
|
140
|
-
return this.pixiSprite.blendMode;
|
|
141
|
-
}
|
|
142
|
-
set blendMode(value) {
|
|
143
|
-
this.pixiSprite.blendMode = value;
|
|
78
|
+
this.spriteDefinition = spriteDefinition;
|
|
79
|
+
this.pixiSprite = new PIXI.Sprite(game_assets_1.GameAssets.getAsset(spriteDefinition.id));
|
|
80
|
+
this.pixiContainer.addChild(this.pixiSprite);
|
|
81
|
+
this.setTextureScale(spriteDefinition.scale);
|
|
82
|
+
if (options.textureSize) {
|
|
83
|
+
this.pixiSprite.width = options.textureSize.x;
|
|
84
|
+
this.pixiSprite.height = options.textureSize.y;
|
|
144
85
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return this;
|
|
86
|
+
if (options.texturePosition) {
|
|
87
|
+
this.pixiSprite.position.set(options.texturePosition.x, options.texturePosition.y);
|
|
148
88
|
}
|
|
149
|
-
|
|
150
|
-
|
|
89
|
+
if (!options.ignoreAnchor) {
|
|
90
|
+
this.pixiSprite.anchor.set(spriteDefinition.anchor.x, spriteDefinition.anchor.y);
|
|
151
91
|
}
|
|
152
|
-
|
|
153
|
-
|
|
92
|
+
}
|
|
93
|
+
destroySelf() {
|
|
94
|
+
super.destroySelf();
|
|
95
|
+
!this.pixiGlowSprite?.destroyed && this.pixiGlowSprite?.destroy();
|
|
96
|
+
this.pixiGlowSprite = undefined;
|
|
97
|
+
this.mask?.destroy();
|
|
98
|
+
this.mask = undefined;
|
|
99
|
+
this.boundingShape?.destroy();
|
|
100
|
+
this.boundingShape = undefined;
|
|
101
|
+
if (this.spriteDefinition.destroyAssetOnDestroy) {
|
|
102
|
+
game_assets_1.GameAssets.destroyAsset(this.spriteDefinition.id);
|
|
154
103
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
104
|
+
}
|
|
105
|
+
setTextureScale(value) {
|
|
106
|
+
this.textureScale = value;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
get textureScale() {
|
|
110
|
+
return this._textureScale;
|
|
111
|
+
}
|
|
112
|
+
set textureScale(value) {
|
|
113
|
+
this._textureScale = value;
|
|
114
|
+
this.pixiSprite.scale.set(value);
|
|
115
|
+
}
|
|
116
|
+
get size() {
|
|
117
|
+
// pixiContainer size can be different because glow filter can increase the size of the sprite
|
|
118
|
+
return new helpers_lib_1.Vector(this.pixiSprite.width, this.pixiSprite.height);
|
|
119
|
+
}
|
|
120
|
+
getMask() {
|
|
121
|
+
return this.pixiSprite;
|
|
122
|
+
}
|
|
123
|
+
set interactive(value) {
|
|
124
|
+
super.interactive = value;
|
|
125
|
+
if (value && this.spriteDefinition.boundingShapes && !this.pixiContainer.hitArea) {
|
|
126
|
+
this.pixiContainer.hitArea = new position_conversion_helper_1.CompositeHitArea(
|
|
127
|
+
this.spriteDefinition.boundingShapes,
|
|
128
|
+
this.size,
|
|
129
|
+
helpers_lib_1.Vector.fromVec2(this.spriteDefinition.anchor)
|
|
130
|
+
);
|
|
158
131
|
}
|
|
159
|
-
|
|
160
|
-
|
|
132
|
+
}
|
|
133
|
+
setMipmap(value) {
|
|
134
|
+
this.mipmap = value;
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
get mipmap() {
|
|
138
|
+
return this.pixiSprite.texture.baseTexture.mipmap === PIXI.MIPMAP_MODES.ON;
|
|
139
|
+
}
|
|
140
|
+
set mipmap(value) {
|
|
141
|
+
if (value) {
|
|
142
|
+
this.pixiSprite.texture.baseTexture.mipmap = PIXI.MIPMAP_MODES.ON;
|
|
143
|
+
} else {
|
|
144
|
+
this.pixiSprite.texture.baseTexture.mipmap = PIXI.MIPMAP_MODES.OFF;
|
|
161
145
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
146
|
+
}
|
|
147
|
+
setBlendMode(value) {
|
|
148
|
+
this.blendMode = value;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
get blendMode() {
|
|
152
|
+
return this.pixiSprite.blendMode;
|
|
153
|
+
}
|
|
154
|
+
set blendMode(value) {
|
|
155
|
+
this.pixiSprite.blendMode = value;
|
|
156
|
+
}
|
|
157
|
+
setTint(tint) {
|
|
158
|
+
this.tint = tint;
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
get tint() {
|
|
162
|
+
return new PIXI.Color(this.pixiSprite.tint).toRgb();
|
|
163
|
+
}
|
|
164
|
+
set tint(value) {
|
|
165
|
+
this.pixiSprite.tint = value;
|
|
166
|
+
}
|
|
167
|
+
setShapeAlpha(value) {
|
|
168
|
+
this.pixiSprite.alpha = value;
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
get shapeAlpha() {
|
|
172
|
+
return this.pixiSprite.alpha;
|
|
173
|
+
}
|
|
174
|
+
set shapeAlpha(value) {
|
|
175
|
+
this.pixiSprite.alpha = value;
|
|
176
|
+
}
|
|
177
|
+
setGlowAlpha(alpha) {
|
|
178
|
+
this.glowAlpha = alpha;
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
get glowAlpha() {
|
|
182
|
+
if (this.pixiGlowSprite) {
|
|
183
|
+
return this.pixiGlowSprite.alpha;
|
|
184
|
+
} else {
|
|
185
|
+
throw new Error(`Sprite: getGlowFilterAlpha cannot be called before glow filter is added.`);
|
|
176
186
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
187
|
+
}
|
|
188
|
+
set glowAlpha(value) {
|
|
189
|
+
if (this.pixiGlowSprite) {
|
|
190
|
+
this.pixiGlowSprite.alpha = value;
|
|
191
|
+
} else {
|
|
192
|
+
throw new Error(`Sprite: setGlowFilterAlpha cannot be called before glow filter is added.`);
|
|
184
193
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @param align the anchor of the desired alignment dimentions of the Sprite is from 0 to 1 like the anchor
|
|
197
|
+
* @returns the vector of the alignment to set the position for the children
|
|
198
|
+
*/
|
|
199
|
+
getAlignmentVector(alignment) {
|
|
200
|
+
const direction = helpers_lib_1.Vector.fromVec2(this.spriteDefinition.anchor).fromTo(alignment);
|
|
201
|
+
return new helpers_lib_1.Vector(this.size.x * direction.x, this.size.y * direction.y);
|
|
202
|
+
}
|
|
203
|
+
setGlowEffect(partialOptions) {
|
|
204
|
+
if (this.pixiGlowSprite) {
|
|
205
|
+
this.pixiGlowSprite.destroy();
|
|
206
|
+
this.pixiGlowSprite = undefined;
|
|
192
207
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.pixiContainer.addChild(this.pixiGlowSprite);
|
|
203
|
-
}
|
|
204
|
-
return this;
|
|
208
|
+
if (partialOptions) {
|
|
209
|
+
this.pixiGlowSprite = glow_sprite_generator_1.GlowSpriteGenerator.createGlowSpriteFromSprite(
|
|
210
|
+
this.pixiSprite,
|
|
211
|
+
partialOptions,
|
|
212
|
+
!this.spriteDefinition.destroyAssetOnDestroy
|
|
213
|
+
);
|
|
214
|
+
this.pixiGlowSprite.position.set(this.pixiSprite.x, this.pixiSprite.y);
|
|
215
|
+
this.pixiGlowSprite.scale.set(this.pixiSprite.scale.x, this.pixiSprite.scale.y);
|
|
216
|
+
this.pixiContainer.addChild(this.pixiGlowSprite);
|
|
205
217
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return this;
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
showBoundingShape(value) {
|
|
221
|
+
if (value) {
|
|
222
|
+
if (!this.boundingShape) {
|
|
223
|
+
this.boundingShape = this.createBoundingShape().setAlpha(0.3).setTint({ r: 0, g: 0, b: 200 }).displayParent(this);
|
|
224
|
+
}
|
|
225
|
+
} else if (this.boundingShape) {
|
|
226
|
+
this.boundingShape.destroy();
|
|
227
|
+
this.boundingShape = undefined;
|
|
217
228
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
getBoundingMask() {
|
|
232
|
+
if (!this.mask) {
|
|
233
|
+
if (!this.spriteDefinition.boundingShapes) {
|
|
234
|
+
throw new Error(`Sprite: cropOverflowingParts cannot be used without polygonDefinition!`);
|
|
235
|
+
}
|
|
236
|
+
this.mask = this.createBoundingShape();
|
|
237
|
+
// PixiJS prevents mask sprites from being rendered, but when there is display object left that uses the mask, it will be rendered.
|
|
238
|
+
// to prevent this, we set the mask's renderable property to false and set the mask's maskRefCount to Number.POSITIVE_INFINITY
|
|
239
|
+
this.mask.pixiSprite['_maskRefCount'] = Number.POSITIVE_INFINITY;
|
|
240
|
+
this.mask.pixiSprite.renderable = false;
|
|
241
|
+
this.mask.displayParent(this);
|
|
231
242
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
243
|
+
return this.mask;
|
|
244
|
+
}
|
|
245
|
+
createBoundingShape() {
|
|
246
|
+
if (!this.spriteDefinition.boundingShapes) {
|
|
247
|
+
throw new Error(`Sprite: bounding shape cannot be created without polygonDefinition!`);
|
|
237
248
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
let a = document.createElement('a');
|
|
248
|
-
document.body.append(a);
|
|
249
|
-
a.download = 'sprite.png';
|
|
250
|
-
a.href = URL.createObjectURL(blob);
|
|
251
|
-
a.click();
|
|
252
|
-
a.remove();
|
|
253
|
-
}, 'image/png');
|
|
254
|
-
return this;
|
|
249
|
+
return graphics_1.Graphics.createPolygon(this.spriteDefinition.boundingShapes, helpers_lib_1.ColorHelper.white)
|
|
250
|
+
.toSprite()
|
|
251
|
+
.attach(this);
|
|
252
|
+
}
|
|
253
|
+
download() {
|
|
254
|
+
const canvas = __1.Game.instance.renderer.extract.canvas(this.pixiContainer);
|
|
255
|
+
if (!canvas.toBlob) {
|
|
256
|
+
throw new Error(`Sprite: canvas.toBlob is undefined!`);
|
|
255
257
|
}
|
|
258
|
+
canvas.toBlob(blob => {
|
|
259
|
+
if (!blob) {
|
|
260
|
+
throw new Error(`Sprite: blob is undefined!`);
|
|
261
|
+
}
|
|
262
|
+
const a = document.createElement('a');
|
|
263
|
+
document.body.append(a);
|
|
264
|
+
a.download = 'sprite.png';
|
|
265
|
+
a.href = URL.createObjectURL(blob);
|
|
266
|
+
a.click();
|
|
267
|
+
a.remove();
|
|
268
|
+
}, 'image/png');
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
256
271
|
}
|
|
257
272
|
exports.Sprite = Sprite;
|
|
258
|
-
//# sourceMappingURL=sprite.js.map
|
|
273
|
+
//# sourceMappingURL=sprite.js.map
|
|
@@ -78,7 +78,7 @@ class RichTextDataInConverter {
|
|
|
78
78
|
result = { ...result, ...options.styles[tag] };
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
let { wordWrapWidth, align, dropShadow, ...supportedStyles } = result;
|
|
81
|
+
let { wordWrapWidth: _wordWrapWidth, align: _align, dropShadow: _dropShadow, ...supportedStyles } = result;
|
|
82
82
|
return supportedStyles;
|
|
83
83
|
}
|
|
84
84
|
static applyNewLines(tokens) {
|
|
@@ -32,14 +32,14 @@ const rich_text_data_in_converter_1 = require("./rich-text-data-in-converter");
|
|
|
32
32
|
const DefaultColor = { r: 100, g: 50, b: 0 };
|
|
33
33
|
const Style1Color = { r: 255, g: 255, b: 255 };
|
|
34
34
|
const Style2Color = { r: 0, g: 100, b: 100 };
|
|
35
|
-
const
|
|
35
|
+
const DefaultRichTextOptions = {
|
|
36
36
|
default: { fontFamily: 'Arial', wordWrapWidth: 100, color: DefaultColor, fontSize: 20 },
|
|
37
37
|
styles: {
|
|
38
38
|
style1: { color: Style1Color, lineHeight: 25 },
|
|
39
39
|
style2: { color: Style2Color, fontSize: 22 }
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
const StyleNames = new Set(Object.keys(
|
|
42
|
+
const StyleNames = new Set(Object.keys(DefaultRichTextOptions.styles));
|
|
43
43
|
const ExpectedResults = {
|
|
44
44
|
default: { fontFamily: 'Arial', color: DefaultColor, fontSize: 20 },
|
|
45
45
|
style1: { fontFamily: 'Arial', color: Style1Color, fontSize: 20, lineHeight: 25 },
|
|
@@ -59,7 +59,7 @@ const ExpectedPixiStyles = {
|
|
|
59
59
|
(0, vitest_1.test)('should handle plain text without tags', () => {
|
|
60
60
|
let text = 'Simple text without any tags';
|
|
61
61
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
62
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
62
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
63
63
|
(0, vitest_1.expect)(result).toEqual([
|
|
64
64
|
{
|
|
65
65
|
text: 'Simple text without any tags',
|
|
@@ -73,7 +73,7 @@ const ExpectedPixiStyles = {
|
|
|
73
73
|
(0, vitest_1.test)('should handle single style tag correctly', () => {
|
|
74
74
|
let text = '<style1>Styled text</style1>';
|
|
75
75
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
76
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
76
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
77
77
|
(0, vitest_1.expect)(result).toEqual([
|
|
78
78
|
{
|
|
79
79
|
text: 'Styled text',
|
|
@@ -87,7 +87,7 @@ const ExpectedPixiStyles = {
|
|
|
87
87
|
(0, vitest_1.test)('should handle text with surrounding styles', () => {
|
|
88
88
|
let text = 'plain text <style1>styled text</style1> more plain text';
|
|
89
89
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
90
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
90
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
91
91
|
(0, vitest_1.expect)(result).toEqual([
|
|
92
92
|
{
|
|
93
93
|
text: 'plain text ',
|
|
@@ -115,7 +115,7 @@ const ExpectedPixiStyles = {
|
|
|
115
115
|
(0, vitest_1.test)('should handle multiple styles', () => {
|
|
116
116
|
let text = '<style1>Text with style1</style1> plain text <style2>text with style2</style2>';
|
|
117
117
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
118
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
118
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
119
119
|
(0, vitest_1.expect)(result).toEqual([
|
|
120
120
|
{
|
|
121
121
|
text: 'Text with style1',
|
|
@@ -143,7 +143,7 @@ const ExpectedPixiStyles = {
|
|
|
143
143
|
(0, vitest_1.test)('should handle nested styles', () => {
|
|
144
144
|
let text = 'Text <style1>with <style2>nested</style2> styles</style1>';
|
|
145
145
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
146
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
146
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
147
147
|
(0, vitest_1.expect)(result).toEqual([
|
|
148
148
|
{
|
|
149
149
|
text: 'Text ',
|
|
@@ -188,7 +188,7 @@ const ExpectedPixiStyles = {
|
|
|
188
188
|
(0, vitest_1.test)('should not accept "default" as a valid tag', () => {
|
|
189
189
|
let text = 'Text with no default tag';
|
|
190
190
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
191
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
191
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
192
192
|
(0, vitest_1.expect)(result).toEqual([
|
|
193
193
|
{
|
|
194
194
|
text: 'Text with no default tag',
|
|
@@ -202,7 +202,7 @@ const ExpectedPixiStyles = {
|
|
|
202
202
|
(0, vitest_1.test)('should match the example in comments', () => {
|
|
203
203
|
let text = 'This is a sample <style1>Hello</style1><style2>World</style2> text';
|
|
204
204
|
let textSegments = script_engine_lib_1.RichTextSeparator.process(text, StyleNames);
|
|
205
|
-
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments,
|
|
205
|
+
let result = rich_text_data_in_converter_1.RichTextDataInConverter['includeStylesToTags'](textSegments, DefaultRichTextOptions);
|
|
206
206
|
(0, vitest_1.expect)(result).toEqual([
|
|
207
207
|
{
|
|
208
208
|
text: 'This is a sample ',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as PIXI from 'pixi.js';
|
|
2
2
|
import { RichTextOptions } from '../rich-text';
|
|
3
|
-
import { PartialTextOptions } from './process-steps/1-data-in-converter/pixi-text-style-converter';
|
|
4
3
|
import { TextData } from '.';
|
|
4
|
+
import { PartialTextOptions } from './process-steps/1-data-in-converter/pixi-text-style-converter';
|
|
5
5
|
export interface ChunkStyle {
|
|
6
6
|
readonly cacheKey: string;
|
|
7
7
|
readonly width: number;
|