laymur 0.15.0 → 0.16.0
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/README.md +47 -40
- package/dist/elements/{UIInputDummy/UIInputDummy.Internal.d.ts → UIDummy/UIDummy.Internal.d.ts} +4 -4
- package/dist/elements/{UIInputDummy/UIInputDummy.d.ts → UIDummy/UIDummy.d.ts} +14 -14
- package/dist/elements/UIElement/UIElement.Internal.d.ts +2 -2
- package/dist/elements/UIElement/UIElement.d.ts +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +82 -106
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4289,9 +4289,7 @@ class UISolverWrapper {
|
|
|
4289
4289
|
* and preserves coefficients and constants.
|
|
4290
4290
|
*/
|
|
4291
4291
|
_private_convertExpression(expression) {
|
|
4292
|
-
return new Expression(...expression
|
|
4293
|
-
.prepareTerms()
|
|
4294
|
-
.map(([variableIndex, coefficient]) => {
|
|
4292
|
+
return new Expression(...expression.prepareTerms().map(([variableIndex, coefficient]) => {
|
|
4295
4293
|
const description = this._private_variables.get(variableIndex);
|
|
4296
4294
|
if (description === undefined) {
|
|
4297
4295
|
throw new Error(`UISolverWrapper.convertExpression.expression: variable does not exist`);
|
|
@@ -4354,8 +4352,7 @@ class UILayer {
|
|
|
4354
4352
|
this._private_sceneWrapperInternal = new UISceneWrapper(width, height);
|
|
4355
4353
|
this.name = options.name ?? LAYER_DEFAULT_NAME;
|
|
4356
4354
|
this._private_modeInternal = options.mode ?? LAYER_DEFAULT_MODE;
|
|
4357
|
-
this._private_orientationInternal =
|
|
4358
|
-
width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
4355
|
+
this._private_orientationInternal = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
4359
4356
|
this.xVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
|
|
4360
4357
|
this.yVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
|
|
4361
4358
|
this.wVariable = this._private_solverWrapperInternal.createVariable(width, UIPriority.P0);
|
|
@@ -4444,10 +4441,7 @@ const EPSILON = 1e-6;
|
|
|
4444
4441
|
* @returns True if object has valid layer property
|
|
4445
4442
|
*/
|
|
4446
4443
|
function isUILayerElement(obj) {
|
|
4447
|
-
return
|
|
4448
|
-
obj !== null &&
|
|
4449
|
-
"layer" in obj &&
|
|
4450
|
-
obj.layer instanceof UILayer);
|
|
4444
|
+
return typeof obj === "object" && obj !== null && "layer" in obj && obj.layer instanceof UILayer;
|
|
4451
4445
|
}
|
|
4452
4446
|
/**
|
|
4453
4447
|
* Checks if object implements UIPointElement.
|
|
@@ -5302,9 +5296,7 @@ function normalizeUIType2D(value) {
|
|
|
5302
5296
|
if (Array.isArray(value)) {
|
|
5303
5297
|
return { h: value[0], v: value[1] };
|
|
5304
5298
|
}
|
|
5305
|
-
if (typeof value === "object" &&
|
|
5306
|
-
value !== null &&
|
|
5307
|
-
("h" in value || "v" in value)) {
|
|
5299
|
+
if (typeof value === "object" && value !== null && ("h" in value || "v" in value)) {
|
|
5308
5300
|
return value;
|
|
5309
5301
|
}
|
|
5310
5302
|
return { h: value, v: value };
|
|
@@ -5744,10 +5736,8 @@ function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, micr
|
|
|
5744
5736
|
else {
|
|
5745
5737
|
const rawAnchorOffsetX = microAnchorX * width;
|
|
5746
5738
|
const rawAnchorOffsetY = microAnchorY * height;
|
|
5747
|
-
TEMP_POSITION.x =
|
|
5748
|
-
|
|
5749
|
-
TEMP_POSITION.y =
|
|
5750
|
-
y + rawAnchorOffsetY - rotatedAnchorY + microY + rotatedTrimY;
|
|
5739
|
+
TEMP_POSITION.x = x + rawAnchorOffsetX - rotatedAnchorX + microX + rotatedTrimX;
|
|
5740
|
+
TEMP_POSITION.y = y + rawAnchorOffsetY - rotatedAnchorY + microY + rotatedTrimY;
|
|
5751
5741
|
}
|
|
5752
5742
|
TEMP_POSITION.z = zIndex;
|
|
5753
5743
|
TEMP_SCALE.x = trimmedWidth * microScaleX;
|
|
@@ -6208,9 +6198,9 @@ const DUMMY_DEFAULT_MODE = UIMode.VISIBLE;
|
|
|
6208
6198
|
const DUMMY_DEFAULT_Z_INDEX = 0;
|
|
6209
6199
|
|
|
6210
6200
|
/** Rectangular area with dimensions but no rendering */
|
|
6211
|
-
class
|
|
6201
|
+
class UIDummy extends UIAnchor {
|
|
6212
6202
|
/**
|
|
6213
|
-
* Creates a new
|
|
6203
|
+
* Creates a new UIDummy instance.
|
|
6214
6204
|
*
|
|
6215
6205
|
* @param layer - Layer containing this element
|
|
6216
6206
|
* @param options - Configuration options
|
|
@@ -6218,23 +6208,23 @@ class UIInputDummy extends UIAnchor {
|
|
|
6218
6208
|
constructor(layer, options) {
|
|
6219
6209
|
const w = options?.width ?? DUMMY_DEFAULT_WIDTH;
|
|
6220
6210
|
const h = options?.height ?? DUMMY_DEFAULT_HEIGHT;
|
|
6221
|
-
assertValidPositiveNumber(w, "
|
|
6222
|
-
assertValidPositiveNumber(h, "
|
|
6211
|
+
assertValidPositiveNumber(w, "UIDummy.constructor.width");
|
|
6212
|
+
assertValidPositiveNumber(h, "UIDummy.constructor.height");
|
|
6223
6213
|
super(layer, options);
|
|
6224
6214
|
this._private_wasPointerInside = false;
|
|
6225
|
-
this.
|
|
6226
|
-
this.
|
|
6227
|
-
this.
|
|
6228
|
-
this.
|
|
6229
|
-
this.
|
|
6215
|
+
this._private_signalPointerPressedInternal = new s();
|
|
6216
|
+
this._private_signalPointerMovedInternal = new s();
|
|
6217
|
+
this._private_signalPointerReleasedInternal = new s();
|
|
6218
|
+
this._private_signalPointerEnteredInternal = new s();
|
|
6219
|
+
this._private_signalPointerLeftInternal = new s();
|
|
6230
6220
|
this.catchPointerDown = (x, y, identifier) => {
|
|
6231
|
-
return this.handleInputEvent(x, y, identifier, this.
|
|
6221
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerPressedInternal);
|
|
6232
6222
|
};
|
|
6233
6223
|
this.catchPointerMove = (x, y, identifier) => {
|
|
6234
|
-
return this.handleInputEvent(x, y, identifier, this.
|
|
6224
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerMovedInternal);
|
|
6235
6225
|
};
|
|
6236
6226
|
this.catchPointerUp = (x, y, identifier) => {
|
|
6237
|
-
return this.handleInputEvent(x, y, identifier, this.
|
|
6227
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerReleasedInternal);
|
|
6238
6228
|
};
|
|
6239
6229
|
this.interactionArea =
|
|
6240
6230
|
options?.interactionArea ?? new UIAreaRectangle(0, 0, 1, 1);
|
|
@@ -6278,53 +6268,53 @@ class UIInputDummy extends UIAnchor {
|
|
|
6278
6268
|
return this.inputWrapper.getZIndex(this._private_catcherHandler);
|
|
6279
6269
|
}
|
|
6280
6270
|
/** Signal fired when pointer is pressed */
|
|
6281
|
-
get
|
|
6282
|
-
return this.
|
|
6271
|
+
get signalPointerPressed() {
|
|
6272
|
+
return this._private_signalPointerPressedInternal;
|
|
6283
6273
|
}
|
|
6284
6274
|
/** Signal fired when pointer is moved */
|
|
6285
|
-
get
|
|
6286
|
-
return this.
|
|
6275
|
+
get signalPointerMoved() {
|
|
6276
|
+
return this._private_signalPointerMovedInternal;
|
|
6287
6277
|
}
|
|
6288
6278
|
/** Signal fired when pointer is released */
|
|
6289
|
-
get
|
|
6290
|
-
return this.
|
|
6279
|
+
get signalPointerReleased() {
|
|
6280
|
+
return this._private_signalPointerReleasedInternal;
|
|
6291
6281
|
}
|
|
6292
6282
|
/** Signal fired when pointer enters element */
|
|
6293
|
-
get
|
|
6294
|
-
return this.
|
|
6283
|
+
get signalPointerEntered() {
|
|
6284
|
+
return this._private_signalPointerEnteredInternal;
|
|
6295
6285
|
}
|
|
6296
6286
|
/** Signal fired when pointer leaves element */
|
|
6297
|
-
get
|
|
6298
|
-
return this.
|
|
6287
|
+
get signalPointerLeft() {
|
|
6288
|
+
return this._private_signalPointerLeftInternal;
|
|
6299
6289
|
}
|
|
6300
6290
|
/** Width in world units */
|
|
6301
6291
|
set width(value) {
|
|
6302
|
-
assertValidPositiveNumber(value, "
|
|
6292
|
+
assertValidPositiveNumber(value, "UIDummy.width");
|
|
6303
6293
|
this.solverWrapper.suggestVariableValue(this.wVariable, value);
|
|
6304
6294
|
}
|
|
6305
6295
|
/** Height in world units */
|
|
6306
6296
|
set height(value) {
|
|
6307
|
-
assertValidPositiveNumber(value, "
|
|
6297
|
+
assertValidPositiveNumber(value, "UIDummy.height");
|
|
6308
6298
|
this.solverWrapper.suggestVariableValue(this.hVariable, value);
|
|
6309
6299
|
}
|
|
6310
6300
|
/** X coordinate of right edge */
|
|
6311
6301
|
set oppositeX(value) {
|
|
6312
|
-
assertValidNumber(value, "
|
|
6302
|
+
assertValidNumber(value, "UIDummy.oppositeX");
|
|
6313
6303
|
this.x = value - this.width;
|
|
6314
6304
|
}
|
|
6315
6305
|
/** Y coordinate of top edge */
|
|
6316
6306
|
set oppositeY(value) {
|
|
6317
|
-
assertValidNumber(value, "
|
|
6307
|
+
assertValidNumber(value, "UIDummy.oppositeY");
|
|
6318
6308
|
this.y = value - this.height;
|
|
6319
6309
|
}
|
|
6320
6310
|
/** X coordinate of horizontal center */
|
|
6321
6311
|
set centerX(value) {
|
|
6322
|
-
assertValidNumber(value, "
|
|
6312
|
+
assertValidNumber(value, "UIDummy.centerX");
|
|
6323
6313
|
this.x = value - this.width / 2;
|
|
6324
6314
|
}
|
|
6325
6315
|
/** Y coordinate of vertical center */
|
|
6326
6316
|
set centerY(value) {
|
|
6327
|
-
assertValidNumber(value, "
|
|
6317
|
+
assertValidNumber(value, "UIDummy.centerY");
|
|
6328
6318
|
this.y = value - this.height / 2;
|
|
6329
6319
|
}
|
|
6330
6320
|
/** Controls visibility and interactivity */
|
|
@@ -6337,7 +6327,7 @@ class UIInputDummy extends UIAnchor {
|
|
|
6337
6327
|
}
|
|
6338
6328
|
/** Rendering and input priority. Higher values on top. */
|
|
6339
6329
|
set zIndex(value) {
|
|
6340
|
-
assertValidNumber(value, "
|
|
6330
|
+
assertValidNumber(value, "UIDummy.zIndex");
|
|
6341
6331
|
this.inputWrapper.setZIndex(this._private_catcherHandler, value);
|
|
6342
6332
|
}
|
|
6343
6333
|
/** Removes element and frees resources */
|
|
@@ -6348,18 +6338,23 @@ class UIInputDummy extends UIAnchor {
|
|
|
6348
6338
|
super.destroy();
|
|
6349
6339
|
}
|
|
6350
6340
|
handleInputEvent(x, y, identifier, signal) {
|
|
6351
|
-
assertValidNumber(x, "
|
|
6352
|
-
assertValidNumber(y, "
|
|
6353
|
-
assertValidNumber(identifier, "
|
|
6341
|
+
assertValidNumber(x, "UIDummy.handleInputEvent.x");
|
|
6342
|
+
assertValidNumber(y, "UIDummy.handleInputEvent.y");
|
|
6343
|
+
assertValidNumber(identifier, "UIDummy.handleInputEvent.identifier");
|
|
6354
6344
|
const isPointerInside = this.interactionArea.contains(MathUtils.mapLinear(x, this.x, this.oppositeX, 0, 1), MathUtils.mapLinear(y, this.y, this.oppositeY, 0, 1));
|
|
6355
6345
|
if (isPointerInside) {
|
|
6356
6346
|
signal.emit({ x, y, identifier, element: this });
|
|
6357
6347
|
}
|
|
6358
6348
|
if (this._private_wasPointerInside && !isPointerInside) {
|
|
6359
|
-
this.
|
|
6349
|
+
this._private_signalPointerLeftInternal.emit({ x, y, identifier, element: this });
|
|
6360
6350
|
}
|
|
6361
6351
|
else if (!this._private_wasPointerInside && isPointerInside) {
|
|
6362
|
-
this.
|
|
6352
|
+
this._private_signalPointerEnteredInternal.emit({
|
|
6353
|
+
x,
|
|
6354
|
+
y,
|
|
6355
|
+
identifier,
|
|
6356
|
+
element: this,
|
|
6357
|
+
});
|
|
6363
6358
|
}
|
|
6364
6359
|
this._private_wasPointerInside = isPointerInside;
|
|
6365
6360
|
return (this.modeInternal !== UIMode.INTERACTIVE_TRANSPARENT && isPointerInside);
|
|
@@ -6369,7 +6364,7 @@ class UIInputDummy extends UIAnchor {
|
|
|
6369
6364
|
const ELEMENT_DEFAULT_TRANSPARENCY_MODE = UITransparencyMode.BLEND;
|
|
6370
6365
|
|
|
6371
6366
|
/** Base class for renderable UI elements */
|
|
6372
|
-
class UIElement extends
|
|
6367
|
+
class UIElement extends UIDummy {
|
|
6373
6368
|
/**
|
|
6374
6369
|
* Creates a new UIElement instance.
|
|
6375
6370
|
*
|
|
@@ -6382,12 +6377,15 @@ class UIElement extends UIInputDummy {
|
|
|
6382
6377
|
super(layer, options);
|
|
6383
6378
|
this._private_transparencyModeDirty = false;
|
|
6384
6379
|
this._private_visibilityDirty = false;
|
|
6380
|
+
this._private_handleWillRender = (renderer, deltaTime) => {
|
|
6381
|
+
this.onWillRender(renderer, deltaTime);
|
|
6382
|
+
};
|
|
6385
6383
|
this.micro = new UIMicro(options?.micro);
|
|
6386
6384
|
this._private_transparencyModeInternal =
|
|
6387
6385
|
options?.transparencyMode ?? ELEMENT_DEFAULT_TRANSPARENCY_MODE;
|
|
6388
6386
|
this.sceneWrapper = this.layer.sceneWrapper;
|
|
6389
6387
|
this.planeHandler = this.sceneWrapper.createPlane(source, properties, new Matrix4().identity(), isUIModeVisible(options?.mode ?? this.mode), this._private_transparencyModeInternal);
|
|
6390
|
-
this.layer.signalRendering.on(this.
|
|
6388
|
+
this.layer.signalRendering.on(this._private_handleWillRender);
|
|
6391
6389
|
}
|
|
6392
6390
|
/** Alpha blending mode */
|
|
6393
6391
|
get transparencyMode() {
|
|
@@ -6409,7 +6407,7 @@ class UIElement extends UIInputDummy {
|
|
|
6409
6407
|
}
|
|
6410
6408
|
/** Removes element and frees resources */
|
|
6411
6409
|
destroy() {
|
|
6412
|
-
this.layer.signalRendering.off(this.
|
|
6410
|
+
this.layer.signalRendering.off(this._private_handleWillRender);
|
|
6413
6411
|
this.sceneWrapper.destroyPlane(this.planeHandler);
|
|
6414
6412
|
super.destroy();
|
|
6415
6413
|
}
|
|
@@ -6488,12 +6486,9 @@ class UIAnimatedImage extends UIElement {
|
|
|
6488
6486
|
this._private_colorInternal = color;
|
|
6489
6487
|
this._private_sequenceInternal = uiTextures;
|
|
6490
6488
|
this._private_textureTransform = textureTransform;
|
|
6491
|
-
this._private_frameRateInternal =
|
|
6492
|
-
|
|
6493
|
-
this.
|
|
6494
|
-
options.timeScale ?? ANIMATED_IMAGE_DEFAULT_TIME_SCALE;
|
|
6495
|
-
this._private_loopModeInternal =
|
|
6496
|
-
options.loopMode ?? ANIMATED_IMAGE_DEFAULT_LOOP_MODE;
|
|
6489
|
+
this._private_frameRateInternal = options.frameRate ?? ANIMATED_IMAGE_DEFAULT_FRAME_RATE;
|
|
6490
|
+
this._private_timeScaleInternal = options.timeScale ?? ANIMATED_IMAGE_DEFAULT_TIME_SCALE;
|
|
6491
|
+
this._private_loopModeInternal = options.loopMode ?? ANIMATED_IMAGE_DEFAULT_LOOP_MODE;
|
|
6497
6492
|
this._private_subscribeSequenceEvents();
|
|
6498
6493
|
if (options.playByDefault === true) {
|
|
6499
6494
|
this.play();
|
|
@@ -6593,9 +6588,7 @@ class UIAnimatedImage extends UIElement {
|
|
|
6593
6588
|
}
|
|
6594
6589
|
/** Stops animation and resets to first frame */
|
|
6595
6590
|
stop() {
|
|
6596
|
-
if (this._private_isPlaying ||
|
|
6597
|
-
this._private_accumulatedTime > 0 ||
|
|
6598
|
-
this._private_sequenceFrameIndex > 0) {
|
|
6591
|
+
if (this._private_isPlaying || this._private_accumulatedTime > 0 || this._private_sequenceFrameIndex > 0) {
|
|
6599
6592
|
this._private_isPlaying = false;
|
|
6600
6593
|
this._private_accumulatedTime = 0;
|
|
6601
6594
|
this._private_sequenceFrameIndex = 0;
|
|
@@ -7260,9 +7253,7 @@ class UINineSlice extends UIElement {
|
|
|
7260
7253
|
}
|
|
7261
7254
|
setPlaneTransform() {
|
|
7262
7255
|
let properties;
|
|
7263
|
-
const sliceBordersDirty = this._private_textureDimensionsDirty ||
|
|
7264
|
-
this._private_sliceBordersInternal.dirty ||
|
|
7265
|
-
this.texture.trimDirty;
|
|
7256
|
+
const sliceBordersDirty = this._private_textureDimensionsDirty || this._private_sliceBordersInternal.dirty || this.texture.trimDirty;
|
|
7266
7257
|
if (sliceBordersDirty) {
|
|
7267
7258
|
properties ?? (properties = {});
|
|
7268
7259
|
properties["sliceBorders"] = this._private_calculateSliceBordersForShader(this._private_sliceBordersVector);
|
|
@@ -7964,18 +7955,14 @@ class UITextStyle {
|
|
|
7964
7955
|
* @returns Complete style configuration with all defaults applied
|
|
7965
7956
|
*/
|
|
7966
7957
|
static resolve(primary, fallback) {
|
|
7967
|
-
const fontSize = primary._private_fontSizeInternal ?? fallback._private_fontSizeInternal ??
|
|
7968
|
-
TEXT_STYLE_DEFAULT_FONT_SIZE;
|
|
7958
|
+
const fontSize = primary._private_fontSizeInternal ?? fallback._private_fontSizeInternal ?? TEXT_STYLE_DEFAULT_FONT_SIZE;
|
|
7969
7959
|
return {
|
|
7970
|
-
color: primary._private_colorInternal ?? fallback._private_colorInternal ??
|
|
7971
|
-
|
|
7972
|
-
align: primary._private_alignInternal ?? fallback._private_alignInternal ??
|
|
7973
|
-
TEXT_STYLE_DEFAULT_ALIGN,
|
|
7960
|
+
color: primary._private_colorInternal ?? fallback._private_colorInternal ?? TEXT_STYLE_DEFAULT_COLOR,
|
|
7961
|
+
align: primary._private_alignInternal ?? fallback._private_alignInternal ?? TEXT_STYLE_DEFAULT_ALIGN,
|
|
7974
7962
|
fontFamily: primary._private_fontFamilyInternal ?? fallback._private_fontFamilyInternal ??
|
|
7975
7963
|
TEXT_STYLE_DEFAULT_FONT_FAMILY,
|
|
7976
7964
|
fontSize,
|
|
7977
|
-
fontStyle: primary._private_fontStyleInternal ?? fallback._private_fontStyleInternal ??
|
|
7978
|
-
TEXT_STYLE_DEFAULT_FONT_STYLE,
|
|
7965
|
+
fontStyle: primary._private_fontStyleInternal ?? fallback._private_fontStyleInternal ?? TEXT_STYLE_DEFAULT_FONT_STYLE,
|
|
7979
7966
|
fontWeight: primary._private_fontWeightInternal ?? fallback._private_fontWeightInternal ??
|
|
7980
7967
|
TEXT_STYLE_DEFAULT_FONT_WEIGHT,
|
|
7981
7968
|
lineHeight: primary._private_lineHeightInternal ?? fallback._private_lineHeightInternal ??
|
|
@@ -8010,8 +7997,7 @@ class UITextStyle {
|
|
|
8010
7997
|
this._private_fontSizeInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE ||
|
|
8011
7998
|
this._private_fontStyleInternal !== TEXT_STYLE_DEFAULT_FONT_STYLE ||
|
|
8012
7999
|
this._private_fontWeightInternal !== TEXT_STYLE_DEFAULT_FONT_WEIGHT ||
|
|
8013
|
-
this._private_lineHeightInternal !==
|
|
8014
|
-
TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
|
|
8000
|
+
this._private_lineHeightInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
|
|
8015
8001
|
this._private_enableShadowInternal !== TEXT_STYLE_DEFAULT_ENABLE_SHADOW ||
|
|
8016
8002
|
this._private_shadowOffsetXInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X ||
|
|
8017
8003
|
this._private_shadowOffsetYInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y ||
|
|
@@ -8026,8 +8012,7 @@ class UITextStyle {
|
|
|
8026
8012
|
this._private_fontSizeInternal = TEXT_STYLE_DEFAULT_FONT_SIZE;
|
|
8027
8013
|
this._private_fontStyleInternal = TEXT_STYLE_DEFAULT_FONT_STYLE;
|
|
8028
8014
|
this._private_fontWeightInternal = TEXT_STYLE_DEFAULT_FONT_WEIGHT;
|
|
8029
|
-
this._private_lineHeightInternal =
|
|
8030
|
-
TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
|
|
8015
|
+
this._private_lineHeightInternal = TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
|
|
8031
8016
|
this._private_enableShadowInternal = TEXT_STYLE_DEFAULT_ENABLE_SHADOW;
|
|
8032
8017
|
this._private_shadowOffsetXInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X;
|
|
8033
8018
|
this._private_shadowOffsetYInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y;
|
|
@@ -8241,8 +8226,7 @@ function buildTextLines(maxWidth, textChunks) {
|
|
|
8241
8226
|
currentLineHeight = 0;
|
|
8242
8227
|
continue;
|
|
8243
8228
|
}
|
|
8244
|
-
if (currentLine.length === 0 ||
|
|
8245
|
-
currentWidth + textChunk.metrics.width <= maxWidth) {
|
|
8229
|
+
if (currentLine.length === 0 || currentWidth + textChunk.metrics.width <= maxWidth) {
|
|
8246
8230
|
currentLine.push(textChunk);
|
|
8247
8231
|
currentWidth += textChunk.metrics.width;
|
|
8248
8232
|
currentHeight = Math.max(currentHeight, textChunk.metrics.height);
|
|
@@ -8416,8 +8400,7 @@ class UIText extends UIElement {
|
|
|
8416
8400
|
this._private_colorInternal = color;
|
|
8417
8401
|
this._private_paddingInternal = new UIInsets(options.padding);
|
|
8418
8402
|
this.commonStyle = new UITextStyle(options.commonStyle);
|
|
8419
|
-
this._private_maxLineWidthInternal =
|
|
8420
|
-
options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
|
|
8403
|
+
this._private_maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
|
|
8421
8404
|
this._private_resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
|
|
8422
8405
|
this._private_canvas = canvas;
|
|
8423
8406
|
this._private_context = context;
|
|
@@ -8465,9 +8448,7 @@ class UIText extends UIElement {
|
|
|
8465
8448
|
set content(value) {
|
|
8466
8449
|
if (this._private_contentInternal !== value) {
|
|
8467
8450
|
if (typeof value === "string") {
|
|
8468
|
-
this._private_contentInternal = [
|
|
8469
|
-
new UITextSpan({ text: value, style: new UITextStyle() }),
|
|
8470
|
-
];
|
|
8451
|
+
this._private_contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
|
|
8471
8452
|
}
|
|
8472
8453
|
else if (Array.isArray(value)) {
|
|
8473
8454
|
this._private_contentInternal = value.map((span) => typeof span === "string"
|
|
@@ -8529,8 +8510,7 @@ class UIText extends UIElement {
|
|
|
8529
8510
|
!this._private_maxLineWidthDirty &&
|
|
8530
8511
|
!this._private_paddingInternal.dirty &&
|
|
8531
8512
|
!(this.solverWrapper.dirty &&
|
|
8532
|
-
this._private_lastWidth / this._private_lastHeight !==
|
|
8533
|
-
Math.round(this.width) / Math.round(this.height)) &&
|
|
8513
|
+
this._private_lastWidth / this._private_lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
|
|
8534
8514
|
!this._private_checkContentDirty()) {
|
|
8535
8515
|
return;
|
|
8536
8516
|
}
|
|
@@ -8623,15 +8603,14 @@ class UIText extends UIElement {
|
|
|
8623
8603
|
}
|
|
8624
8604
|
_private_checkDimensionsDirty() {
|
|
8625
8605
|
return (this.solverWrapper.dirty &&
|
|
8626
|
-
(this._private_lastWidth !== Math.round(this.width) ||
|
|
8627
|
-
this._private_lastHeight !== Math.round(this.height)));
|
|
8606
|
+
(this._private_lastWidth !== Math.round(this.width) || this._private_lastHeight !== Math.round(this.height)));
|
|
8628
8607
|
}
|
|
8629
8608
|
_private_setDimensionsDirtyFalse() {
|
|
8630
8609
|
this._private_lastWidth = Math.round(this.width);
|
|
8631
8610
|
this._private_lastHeight = Math.round(this.height);
|
|
8632
8611
|
}
|
|
8633
8612
|
_private_checkContentDirty() {
|
|
8634
|
-
return
|
|
8613
|
+
return this._private_contentDirty || this.content.some((span) => span.dirty);
|
|
8635
8614
|
}
|
|
8636
8615
|
_private_setContentDirtyFalse() {
|
|
8637
8616
|
this._private_contentDirty = false;
|
|
@@ -8671,9 +8650,9 @@ class UIFullscreenLayer extends UILayer {
|
|
|
8671
8650
|
...options,
|
|
8672
8651
|
});
|
|
8673
8652
|
this._private_resizePolicyDirty = false;
|
|
8674
|
-
this.
|
|
8675
|
-
this.
|
|
8676
|
-
this.
|
|
8653
|
+
this._private_signalPointerPressedInternal = new s();
|
|
8654
|
+
this._private_signalPointerMovedInternal = new s();
|
|
8655
|
+
this._private_signalPointerReleasedInternal = new s();
|
|
8677
8656
|
this._private_onResize = () => {
|
|
8678
8657
|
const scale = this.resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
|
|
8679
8658
|
this.resizePolicy.dirty = false;
|
|
@@ -8681,13 +8660,13 @@ class UIFullscreenLayer extends UILayer {
|
|
|
8681
8660
|
this.resizeInternal(window.innerWidth * scale, window.innerHeight * scale);
|
|
8682
8661
|
};
|
|
8683
8662
|
this._private_onPointerDown = (event) => {
|
|
8684
|
-
this._private_handleWindowInput(event, "onPointerDown", this.
|
|
8663
|
+
this._private_handleWindowInput(event, "onPointerDown", this._private_signalPointerPressedInternal);
|
|
8685
8664
|
};
|
|
8686
8665
|
this._private_onPointerMove = (event) => {
|
|
8687
|
-
this._private_handleWindowInput(event, "onPointerMove", this.
|
|
8666
|
+
this._private_handleWindowInput(event, "onPointerMove", this._private_signalPointerMovedInternal);
|
|
8688
8667
|
};
|
|
8689
8668
|
this._private_onPointerUp = (event) => {
|
|
8690
|
-
this._private_handleWindowInput(event, "onPointerUp", this.
|
|
8669
|
+
this._private_handleWindowInput(event, "onPointerUp", this._private_signalPointerReleasedInternal);
|
|
8691
8670
|
};
|
|
8692
8671
|
this._private_resizePolicyInternal = resizePolicy;
|
|
8693
8672
|
window.addEventListener("resize", this._private_onResize);
|
|
@@ -8700,16 +8679,16 @@ class UIFullscreenLayer extends UILayer {
|
|
|
8700
8679
|
return this._private_resizePolicyInternal;
|
|
8701
8680
|
}
|
|
8702
8681
|
/** Signal fired when pointer is pressed */
|
|
8703
|
-
get
|
|
8704
|
-
return this.
|
|
8682
|
+
get signalPointerPressed() {
|
|
8683
|
+
return this._private_signalPointerPressedInternal;
|
|
8705
8684
|
}
|
|
8706
8685
|
/** Signal fired when pointer is moved */
|
|
8707
|
-
get
|
|
8708
|
-
return this.
|
|
8686
|
+
get signalPointerMoved() {
|
|
8687
|
+
return this._private_signalPointerMovedInternal;
|
|
8709
8688
|
}
|
|
8710
8689
|
/** Signal fired when pointer is released */
|
|
8711
|
-
get
|
|
8712
|
-
return this.
|
|
8690
|
+
get signalPointerReleased() {
|
|
8691
|
+
return this._private_signalPointerReleasedInternal;
|
|
8713
8692
|
}
|
|
8714
8693
|
/** Updates resize policy */
|
|
8715
8694
|
set resizePolicy(value) {
|
|
@@ -8855,10 +8834,7 @@ class UIAreaPolygon extends UIArea {
|
|
|
8855
8834
|
const previousX = previousVertex.x;
|
|
8856
8835
|
const previousY = previousVertex.y;
|
|
8857
8836
|
if (currentY > pointY !== previousY > pointY &&
|
|
8858
|
-
pointX <
|
|
8859
|
-
((previousX - currentX) * (pointY - currentY)) /
|
|
8860
|
-
(previousY - currentY) +
|
|
8861
|
-
currentX) {
|
|
8837
|
+
pointX < ((previousX - currentX) * (pointY - currentY)) / (previousY - currentY) + currentX) {
|
|
8862
8838
|
inside = !inside;
|
|
8863
8839
|
}
|
|
8864
8840
|
}
|
|
@@ -9266,5 +9242,5 @@ class UIResizePolicyFixedWidth extends UIResizePolicy {
|
|
|
9266
9242
|
}
|
|
9267
9243
|
}
|
|
9268
9244
|
|
|
9269
|
-
export { UIAnchor, UIAnimatedImage, UIAnimatedImageLoopMode, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalInterpolationConstraint, UIHorizontalProportionConstraint, UIImage,
|
|
9245
|
+
export { UIAnchor, UIAnimatedImage, UIAnimatedImageLoopMode, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIDummy, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalInterpolationConstraint, UIHorizontalProportionConstraint, UIImage, UILayer, UIMicro, UIMicroAnchorMode, UIMode, UINineSlice, UINineSliceRegionMode, UIOrientation, UIPriority, UIProgress, UIProgressMaskFunctionCircular, UIProgressMaskFunctionDirectional, UIRelation, UIResizePolicyCover, UIResizePolicyCross, UIResizePolicyCrossInverted, UIResizePolicyFit, UIResizePolicyFixedHeight, UIResizePolicyFixedWidth, UIResizePolicyNone, UIScene, UISceneUpdateMode, UISingleParameterConstraint, UIText, UITextResizeMode, UITransparencyMode, UIVerticalDistanceConstraint, UIVerticalInterpolationConstraint, UIVerticalProportionConstraint, UIWidthConstraint };
|
|
9270
9246
|
//# sourceMappingURL=index.js.map
|