@number10/phaserjsx 0.5.2 → 0.6.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/dist/{TransformOriginView-2QSoN8wM.cjs → TransformOriginView-DsD_qZno.cjs} +242 -247
- package/dist/{TransformOriginView-2QSoN8wM.cjs.map → TransformOriginView-DsD_qZno.cjs.map} +1 -1
- package/dist/{TransformOriginView-Bh_khdJD.js → TransformOriginView-uYYqbEHW.js} +260 -265
- package/dist/{TransformOriginView-Bh_khdJD.js.map → TransformOriginView-uYYqbEHW.js.map} +1 -1
- package/dist/colors/color-utils.d.ts +24 -0
- package/dist/colors/color-utils.d.ts.map +1 -1
- package/dist/colors/index.d.ts +2 -2
- package/dist/colors/index.d.ts.map +1 -1
- package/dist/components/appliers/applyGestures.d.ts.map +1 -1
- package/dist/components/custom/Accordion.d.ts.map +1 -1
- package/dist/components/custom/CharText/CharText.d.ts.map +1 -1
- package/dist/components/custom/CharTextInput.d.ts.map +1 -1
- package/dist/components/custom/Joystick.d.ts.map +1 -1
- package/dist/components/custom/NineSliceButton.d.ts.map +1 -1
- package/dist/components/custom/RefOriginView.d.ts.map +1 -1
- package/dist/components/custom/ScrollView.d.ts.map +1 -1
- package/dist/components/custom/Slider.d.ts +1 -2
- package/dist/components/custom/Slider.d.ts.map +1 -1
- package/dist/components/custom/TransformOriginView.d.ts +1 -2
- package/dist/components/custom/TransformOriginView.d.ts.map +1 -1
- package/dist/components/custom/WrapText.d.ts.map +1 -1
- package/dist/components/custom/index.cjs +1 -1
- package/dist/components/custom/index.js +1 -1
- package/dist/components/internal/SceneWrapper.d.ts +3 -3
- package/dist/components/internal/SceneWrapper.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -8027,7 +8027,7 @@ const strategies = {
|
|
|
8027
8027
|
stack: new StackLayoutStrategy()
|
|
8028
8028
|
};
|
|
8029
8029
|
const LAYOUT_CYCLE_EPSILON = 0.5;
|
|
8030
|
-
const LAYOUT_CYCLE_TIME_MS =
|
|
8030
|
+
const LAYOUT_CYCLE_TIME_MS = 20;
|
|
8031
8031
|
const LAYOUT_CYCLE_MAX = 5;
|
|
8032
8032
|
const LAYOUT_MAX_SIZE = 2e5;
|
|
8033
8033
|
const layoutCycleGuard = /* @__PURE__ */ new WeakMap();
|
|
@@ -8496,6 +8496,28 @@ function numberToRgb(num) {
|
|
|
8496
8496
|
b: num & 255
|
|
8497
8497
|
};
|
|
8498
8498
|
}
|
|
8499
|
+
function rgbToHsl(r, g, b) {
|
|
8500
|
+
const red = r / 255;
|
|
8501
|
+
const green = g / 255;
|
|
8502
|
+
const blue = b / 255;
|
|
8503
|
+
const max = Math.max(red, green, blue);
|
|
8504
|
+
const min = Math.min(red, green, blue);
|
|
8505
|
+
const delta = max - min;
|
|
8506
|
+
const light = (max + min) / 2;
|
|
8507
|
+
if (delta === 0) {
|
|
8508
|
+
return { h: 0, s: 0, l: light };
|
|
8509
|
+
}
|
|
8510
|
+
const saturationValue = light > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
|
8511
|
+
let hueValue = 0;
|
|
8512
|
+
if (max === red) {
|
|
8513
|
+
hueValue = (green - blue) / delta + (green < blue ? 6 : 0);
|
|
8514
|
+
} else if (max === green) {
|
|
8515
|
+
hueValue = (blue - red) / delta + 2;
|
|
8516
|
+
} else {
|
|
8517
|
+
hueValue = (red - green) / delta + 4;
|
|
8518
|
+
}
|
|
8519
|
+
return { h: hueValue / 6, s: saturationValue, l: light };
|
|
8520
|
+
}
|
|
8499
8521
|
function lighten(color, amount) {
|
|
8500
8522
|
const rgb = numberToRgb(color);
|
|
8501
8523
|
const factor = Math.max(0, Math.min(1, amount));
|
|
@@ -12937,15 +12959,11 @@ function Accordion(props) {
|
|
|
12937
12959
|
const animated = props.animated ?? themed.animated ?? false;
|
|
12938
12960
|
const animationConfig = props.animationConfig ?? themed.animationConfig ?? "gentle";
|
|
12939
12961
|
const [measuredHeight, setMeasuredHeight] = useState(maxHeight);
|
|
12940
|
-
|
|
12962
|
+
useLayoutEffect(() => {
|
|
12941
12963
|
if (autoHeight && isOpen && measurementRef.current) {
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
setMeasuredHeight(height);
|
|
12946
|
-
setContentHeight(height);
|
|
12947
|
-
}
|
|
12948
|
-
}, 0);
|
|
12964
|
+
const height = measurementRef.current.height;
|
|
12965
|
+
setMeasuredHeight(height);
|
|
12966
|
+
setContentHeight(height);
|
|
12949
12967
|
}
|
|
12950
12968
|
}, [isOpen, autoHeight]);
|
|
12951
12969
|
const [contentHeight, setContentHeight] = useSpring(
|
|
@@ -13397,7 +13415,9 @@ function WrapText(props) {
|
|
|
13397
13415
|
if (measureRafRef.current !== null) {
|
|
13398
13416
|
return;
|
|
13399
13417
|
}
|
|
13400
|
-
|
|
13418
|
+
if (!container.scene) return;
|
|
13419
|
+
measureRafRef.current = 1;
|
|
13420
|
+
getRenderContext(container.scene).deferLayout(() => {
|
|
13401
13421
|
measureRafRef.current = null;
|
|
13402
13422
|
performMeasure();
|
|
13403
13423
|
});
|
|
@@ -13442,10 +13462,7 @@ function WrapText(props) {
|
|
|
13442
13462
|
}, [scene, wrap, measureWidth]);
|
|
13443
13463
|
useEffect(() => {
|
|
13444
13464
|
return () => {
|
|
13445
|
-
|
|
13446
|
-
cancelAnimationFrame(measureRafRef.current);
|
|
13447
|
-
measureRafRef.current = null;
|
|
13448
|
-
}
|
|
13465
|
+
measureRafRef.current = null;
|
|
13449
13466
|
};
|
|
13450
13467
|
}, []);
|
|
13451
13468
|
const measuredWidth = containerWidth > 0 ? containerWidth : lastWidthRef.current;
|
|
@@ -13896,95 +13913,84 @@ function CharText(props) {
|
|
|
13896
13913
|
props.onApiReady(api);
|
|
13897
13914
|
}
|
|
13898
13915
|
}, [containerReady, props.onApiReady]);
|
|
13899
|
-
|
|
13916
|
+
useLayoutEffect(() => {
|
|
13900
13917
|
if (!internalRef.current) return;
|
|
13901
13918
|
const container = internalRef.current;
|
|
13902
13919
|
const scene = container.scene;
|
|
13903
13920
|
const prevText = chars.map((c) => c.char).join("");
|
|
13904
13921
|
if (displayedText === prevText) return;
|
|
13905
|
-
const
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
for (const
|
|
13925
|
-
|
|
13926
|
-
allChars.push(charInfo);
|
|
13927
|
-
}
|
|
13922
|
+
const startX = padLeft;
|
|
13923
|
+
const startY = padTop;
|
|
13924
|
+
const effectiveMaxWidth = multiline && props.maxWidth !== void 0 && typeof props.maxWidth === "number" ? props.maxWidth - horizontalPadding : multiline && props.width !== void 0 && typeof props.width === "number" ? props.width - horizontalPadding : Infinity;
|
|
13925
|
+
let lines;
|
|
13926
|
+
let allChars;
|
|
13927
|
+
if (multiline) {
|
|
13928
|
+
lines = breakIntoLines(
|
|
13929
|
+
displayedText,
|
|
13930
|
+
scene,
|
|
13931
|
+
effectiveMaxWidth,
|
|
13932
|
+
textStyle,
|
|
13933
|
+
charSpacing,
|
|
13934
|
+
multiline,
|
|
13935
|
+
wordWrap
|
|
13936
|
+
);
|
|
13937
|
+
positionLinesVertically(lines, lineHeight);
|
|
13938
|
+
lines = handleOverflow(lines, maxLines, textOverflow);
|
|
13939
|
+
allChars = [];
|
|
13940
|
+
for (const line of lines) {
|
|
13941
|
+
for (const charInfo of line.chars) {
|
|
13942
|
+
allChars.push(charInfo);
|
|
13928
13943
|
}
|
|
13929
|
-
} else {
|
|
13930
|
-
allChars = [];
|
|
13931
|
-
let currentX = 0;
|
|
13932
|
-
for (let i = 0; i < displayedText.length; i++) {
|
|
13933
|
-
const char = displayedText.charAt(i);
|
|
13934
|
-
const tempText = scene.add.text(0, 0, char, textStyle ?? {});
|
|
13935
|
-
const charWidth = tempText.width;
|
|
13936
|
-
const charHeight = tempText.height;
|
|
13937
|
-
tempText.destroy();
|
|
13938
|
-
allChars.push({
|
|
13939
|
-
char,
|
|
13940
|
-
textObject: null,
|
|
13941
|
-
x: currentX,
|
|
13942
|
-
y: 0,
|
|
13943
|
-
width: charWidth,
|
|
13944
|
-
height: charHeight,
|
|
13945
|
-
lineIndex: 0,
|
|
13946
|
-
charIndex: i,
|
|
13947
|
-
lineCharIndex: i
|
|
13948
|
-
});
|
|
13949
|
-
currentX += charWidth + charSpacing;
|
|
13950
|
-
}
|
|
13951
|
-
lines = allChars.length > 0 ? [createLineInfo(allChars, 0, charSpacing)] : [];
|
|
13952
|
-
}
|
|
13953
|
-
const usedTextObjects = [];
|
|
13954
|
-
for (const charInfo of allChars) {
|
|
13955
|
-
const textObj = getTextObject(
|
|
13956
|
-
scene,
|
|
13957
|
-
container,
|
|
13958
|
-
textStyle,
|
|
13959
|
-
textObjectPool,
|
|
13960
|
-
activeTextObjects
|
|
13961
|
-
);
|
|
13962
|
-
textObj.setText(charInfo.char);
|
|
13963
|
-
textObj.setPosition(startX + charInfo.x, startY + charInfo.y);
|
|
13964
|
-
charInfo.textObject = textObj;
|
|
13965
|
-
usedTextObjects.push(textObj);
|
|
13966
13944
|
}
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13945
|
+
} else {
|
|
13946
|
+
allChars = [];
|
|
13947
|
+
let currentX = 0;
|
|
13948
|
+
for (let i = 0; i < displayedText.length; i++) {
|
|
13949
|
+
const char = displayedText.charAt(i);
|
|
13950
|
+
const tempText = scene.add.text(0, 0, char, textStyle ?? {});
|
|
13951
|
+
const charWidth = tempText.width;
|
|
13952
|
+
const charHeight = tempText.height;
|
|
13953
|
+
tempText.destroy();
|
|
13954
|
+
allChars.push({
|
|
13955
|
+
char,
|
|
13956
|
+
textObject: null,
|
|
13957
|
+
x: currentX,
|
|
13958
|
+
y: 0,
|
|
13959
|
+
width: charWidth,
|
|
13960
|
+
height: charHeight,
|
|
13961
|
+
lineIndex: 0,
|
|
13962
|
+
charIndex: i,
|
|
13963
|
+
lineCharIndex: i
|
|
13964
|
+
});
|
|
13965
|
+
currentX += charWidth + charSpacing;
|
|
13972
13966
|
}
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13967
|
+
lines = allChars.length > 0 ? [createLineInfo(allChars, 0, charSpacing)] : [];
|
|
13968
|
+
}
|
|
13969
|
+
const usedTextObjects = [];
|
|
13970
|
+
for (const charInfo of allChars) {
|
|
13971
|
+
const textObj = getTextObject(scene, container, textStyle, textObjectPool, activeTextObjects);
|
|
13972
|
+
textObj.setText(charInfo.char);
|
|
13973
|
+
textObj.setPosition(startX + charInfo.x, startY + charInfo.y);
|
|
13974
|
+
charInfo.textObject = textObj;
|
|
13975
|
+
usedTextObjects.push(textObj);
|
|
13976
|
+
}
|
|
13977
|
+
const currentActive = [...activeTextObjects.current];
|
|
13978
|
+
for (const textObj of currentActive) {
|
|
13979
|
+
if (!usedTextObjects.includes(textObj)) {
|
|
13980
|
+
returnToPool(textObj, textObjectPool, activeTextObjects);
|
|
13980
13981
|
}
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13982
|
+
}
|
|
13983
|
+
const calculatedWidth = lines.length > 0 ? Math.max(...lines.map((l) => l.width)) : 0;
|
|
13984
|
+
let calculatedHeight = 0;
|
|
13985
|
+
if (lines.length > 0) {
|
|
13986
|
+
const lastLine = lines[lines.length - 1];
|
|
13987
|
+
if (lastLine) {
|
|
13988
|
+
calculatedHeight = lastLine.y + lastLine.height;
|
|
13989
|
+
}
|
|
13990
|
+
}
|
|
13991
|
+
setChars(allChars);
|
|
13992
|
+
setWidth(calculatedWidth + horizontalPadding);
|
|
13993
|
+
setHeight(calculatedHeight + verticalPadding);
|
|
13988
13994
|
}, [
|
|
13989
13995
|
displayedText,
|
|
13990
13996
|
textStyle,
|
|
@@ -14001,7 +14007,7 @@ function CharText(props) {
|
|
|
14001
14007
|
props.maxWidth,
|
|
14002
14008
|
props.width
|
|
14003
14009
|
]);
|
|
14004
|
-
|
|
14010
|
+
useLayoutEffect(() => {
|
|
14005
14011
|
if (!internalRef.current || !showCursor) {
|
|
14006
14012
|
if (cursorRef.current) {
|
|
14007
14013
|
cursorRef.current.setVisible(false);
|
|
@@ -14015,97 +14021,95 @@ function CharText(props) {
|
|
|
14015
14021
|
const container = internalRef.current;
|
|
14016
14022
|
const scene = container.scene;
|
|
14017
14023
|
if (chars.length === 0 && displayedText.length > 0) return;
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
if (char.charIndex
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
if (charBeforeCursor) {
|
|
14035
|
-
if (isAfterNewline) {
|
|
14036
|
-
const nextLineIndex = charBeforeCursor.lineIndex + 1;
|
|
14037
|
-
const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex);
|
|
14038
|
-
if (firstCharOfNextLine) {
|
|
14039
|
-
cursorX = startX + firstCharOfNextLine.x;
|
|
14040
|
-
cursorY = startY + firstCharOfNextLine.y;
|
|
14041
|
-
} else {
|
|
14042
|
-
cursorX = startX;
|
|
14043
|
-
const lineHeightPx = charBeforeCursor.height * lineHeight;
|
|
14044
|
-
cursorY = startY + charBeforeCursor.y + lineHeightPx;
|
|
14045
|
-
}
|
|
14046
|
-
} else {
|
|
14047
|
-
cursorX = startX + charBeforeCursor.x + charBeforeCursor.width + charSpacing;
|
|
14048
|
-
cursorY = startY + charBeforeCursor.y;
|
|
14049
|
-
}
|
|
14050
|
-
} else if (chars.length > 0 && chars[0]) {
|
|
14051
|
-
const firstChar = chars[0];
|
|
14052
|
-
cursorX = startX + firstChar.x;
|
|
14053
|
-
cursorY = startY + firstChar.y;
|
|
14054
|
-
} else {
|
|
14055
|
-
cursorX = startX;
|
|
14056
|
-
cursorY = startY;
|
|
14057
|
-
}
|
|
14058
|
-
let cursorHeight = 20;
|
|
14024
|
+
const startX = padLeft;
|
|
14025
|
+
const startY = padTop;
|
|
14026
|
+
let cursorX = startX;
|
|
14027
|
+
let cursorY = startY;
|
|
14028
|
+
const clampedPosition = Math.max(0, Math.min(cursorPosition, displayedText.length));
|
|
14029
|
+
let charBeforeCursor = null;
|
|
14030
|
+
for (const char of chars) {
|
|
14031
|
+
if (char.charIndex < clampedPosition) {
|
|
14032
|
+
if (!charBeforeCursor || char.charIndex > charBeforeCursor.charIndex) {
|
|
14033
|
+
charBeforeCursor = char;
|
|
14034
|
+
}
|
|
14035
|
+
}
|
|
14036
|
+
}
|
|
14037
|
+
const charBeforeCursorInText = clampedPosition > 0 ? displayedText.charAt(clampedPosition - 1) : null;
|
|
14038
|
+
const isAfterNewline = charBeforeCursorInText === "\n";
|
|
14039
|
+
if (charBeforeCursor) {
|
|
14059
14040
|
if (isAfterNewline) {
|
|
14060
|
-
const nextLineIndex = charBeforeCursor
|
|
14041
|
+
const nextLineIndex = charBeforeCursor.lineIndex + 1;
|
|
14061
14042
|
const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex);
|
|
14062
14043
|
if (firstCharOfNextLine) {
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14044
|
+
cursorX = startX + firstCharOfNextLine.x;
|
|
14045
|
+
cursorY = startY + firstCharOfNextLine.y;
|
|
14046
|
+
} else {
|
|
14047
|
+
cursorX = startX;
|
|
14048
|
+
const lineHeightPx = charBeforeCursor.height * lineHeight;
|
|
14049
|
+
cursorY = startY + charBeforeCursor.y + lineHeightPx;
|
|
14068
14050
|
}
|
|
14051
|
+
} else {
|
|
14052
|
+
cursorX = startX + charBeforeCursor.x + charBeforeCursor.width + charSpacing;
|
|
14053
|
+
cursorY = startY + charBeforeCursor.y;
|
|
14054
|
+
}
|
|
14055
|
+
} else if (chars.length > 0 && chars[0]) {
|
|
14056
|
+
const firstChar = chars[0];
|
|
14057
|
+
cursorX = startX + firstChar.x;
|
|
14058
|
+
cursorY = startY + firstChar.y;
|
|
14059
|
+
} else {
|
|
14060
|
+
cursorX = startX;
|
|
14061
|
+
cursorY = startY;
|
|
14062
|
+
}
|
|
14063
|
+
let cursorHeight = 20;
|
|
14064
|
+
if (isAfterNewline) {
|
|
14065
|
+
const nextLineIndex = charBeforeCursor ? charBeforeCursor.lineIndex + 1 : 0;
|
|
14066
|
+
const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex);
|
|
14067
|
+
if (firstCharOfNextLine) {
|
|
14068
|
+
cursorHeight = firstCharOfNextLine.height;
|
|
14069
14069
|
} else if (charBeforeCursor) {
|
|
14070
14070
|
cursorHeight = charBeforeCursor.height;
|
|
14071
14071
|
} else if (chars.length > 0 && chars[0]) {
|
|
14072
14072
|
cursorHeight = chars[0].height;
|
|
14073
14073
|
}
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
duration: cursorBlinkSpeed,
|
|
14104
|
-
yoyo: true,
|
|
14105
|
-
repeat: -1
|
|
14106
|
-
});
|
|
14074
|
+
} else if (charBeforeCursor) {
|
|
14075
|
+
cursorHeight = charBeforeCursor.height;
|
|
14076
|
+
} else if (chars.length > 0 && chars[0]) {
|
|
14077
|
+
cursorHeight = chars[0].height;
|
|
14078
|
+
}
|
|
14079
|
+
if (!cursorRef.current) {
|
|
14080
|
+
cursorRef.current = scene.add.rectangle(
|
|
14081
|
+
cursorX,
|
|
14082
|
+
cursorY,
|
|
14083
|
+
cursorWidth,
|
|
14084
|
+
cursorHeight,
|
|
14085
|
+
cursorColor
|
|
14086
|
+
);
|
|
14087
|
+
cursorRef.current.setOrigin(0, 0);
|
|
14088
|
+
container.add(cursorRef.current);
|
|
14089
|
+
cursorTweenRef.current = scene.tweens.add({
|
|
14090
|
+
targets: cursorRef.current,
|
|
14091
|
+
alpha: { from: 1, to: 0 },
|
|
14092
|
+
duration: cursorBlinkSpeed,
|
|
14093
|
+
yoyo: true,
|
|
14094
|
+
repeat: -1
|
|
14095
|
+
});
|
|
14096
|
+
} else {
|
|
14097
|
+
cursorRef.current.setPosition(cursorX, cursorY);
|
|
14098
|
+
cursorRef.current.setSize(cursorWidth, cursorHeight);
|
|
14099
|
+
cursorRef.current.setFillStyle(cursorColor);
|
|
14100
|
+
cursorRef.current.setVisible(true);
|
|
14101
|
+
if (cursorTweenRef.current) {
|
|
14102
|
+
cursorTweenRef.current.stop();
|
|
14107
14103
|
}
|
|
14108
|
-
|
|
14104
|
+
cursorRef.current.setAlpha(1);
|
|
14105
|
+
cursorTweenRef.current = scene.tweens.add({
|
|
14106
|
+
targets: cursorRef.current,
|
|
14107
|
+
alpha: { from: 1, to: 0 },
|
|
14108
|
+
duration: cursorBlinkSpeed,
|
|
14109
|
+
yoyo: true,
|
|
14110
|
+
repeat: -1
|
|
14111
|
+
});
|
|
14112
|
+
}
|
|
14109
14113
|
return () => {
|
|
14110
14114
|
if (cursorTweenRef.current) {
|
|
14111
14115
|
cursorTweenRef.current.stop();
|
|
@@ -14123,7 +14127,7 @@ function CharText(props) {
|
|
|
14123
14127
|
padTop,
|
|
14124
14128
|
charSpacing
|
|
14125
14129
|
]);
|
|
14126
|
-
|
|
14130
|
+
useLayoutEffect(() => {
|
|
14127
14131
|
if (!internalRef.current) return;
|
|
14128
14132
|
const container = internalRef.current;
|
|
14129
14133
|
const scene = container.scene;
|
|
@@ -14133,43 +14137,41 @@ function CharText(props) {
|
|
|
14133
14137
|
return;
|
|
14134
14138
|
}
|
|
14135
14139
|
if (chars.length === 0) return;
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
selectionRefs.current.push(selectionRect);
|
|
14170
|
-
}
|
|
14140
|
+
const startX = padLeft;
|
|
14141
|
+
const startY = padTop;
|
|
14142
|
+
const lineGroups = /* @__PURE__ */ new Map();
|
|
14143
|
+
for (const char of chars) {
|
|
14144
|
+
if (char && char.charIndex >= selectionStart && char.charIndex < selectionEnd) {
|
|
14145
|
+
const lineIndex = char.lineIndex;
|
|
14146
|
+
if (!lineGroups.has(lineIndex)) {
|
|
14147
|
+
lineGroups.set(lineIndex, []);
|
|
14148
|
+
}
|
|
14149
|
+
lineGroups.get(lineIndex)?.push(char);
|
|
14150
|
+
}
|
|
14151
|
+
}
|
|
14152
|
+
for (const [_lineIndex, lineChars] of lineGroups) {
|
|
14153
|
+
if (lineChars.length === 0) continue;
|
|
14154
|
+
const firstChar = lineChars[0];
|
|
14155
|
+
const lastChar = lineChars[lineChars.length - 1];
|
|
14156
|
+
if (firstChar && lastChar) {
|
|
14157
|
+
const selectionX = startX + firstChar.x;
|
|
14158
|
+
const selectionY = startY + firstChar.y;
|
|
14159
|
+
const selectionWidth = lastChar.x + lastChar.width - firstChar.x + (lineChars.length > 1 ? charSpacing : 0);
|
|
14160
|
+
const selectionHeight = firstChar.height;
|
|
14161
|
+
const selectionRect = scene.add.rectangle(
|
|
14162
|
+
selectionX,
|
|
14163
|
+
selectionY,
|
|
14164
|
+
selectionWidth,
|
|
14165
|
+
selectionHeight,
|
|
14166
|
+
selectionColor,
|
|
14167
|
+
selectionAlpha
|
|
14168
|
+
);
|
|
14169
|
+
selectionRect.setOrigin(0, 0);
|
|
14170
|
+
container.add(selectionRect);
|
|
14171
|
+
container.moveDown(selectionRect);
|
|
14172
|
+
selectionRefs.current.push(selectionRect);
|
|
14171
14173
|
}
|
|
14172
|
-
}
|
|
14174
|
+
}
|
|
14173
14175
|
return () => {
|
|
14174
14176
|
selectionRefs.current.forEach((rect) => rect.destroy());
|
|
14175
14177
|
selectionRefs.current = [];
|
|
@@ -14254,11 +14256,9 @@ function CharTextInput(props) {
|
|
|
14254
14256
|
const selectionStart = selectionAnchor >= 0 ? Math.min(selectionAnchor, cursorPosition) : -1;
|
|
14255
14257
|
const selectionEnd = selectionAnchor >= 0 ? Math.max(selectionAnchor, cursorPosition) : -1;
|
|
14256
14258
|
const redraw = useRedraw();
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
clearTimeout(timer);
|
|
14261
|
-
};
|
|
14259
|
+
useLayoutEffect(() => {
|
|
14260
|
+
if (!containerRef.current) return;
|
|
14261
|
+
redraw();
|
|
14262
14262
|
}, [containerRef.current]);
|
|
14263
14263
|
useEffect(() => {
|
|
14264
14264
|
if (!containerRef.current) return;
|
|
@@ -14733,7 +14733,7 @@ function ScrollView(props) {
|
|
|
14733
14733
|
};
|
|
14734
14734
|
const resolvedSnapThreshold = typeof snap === "object" && "positions" in snap ? snap.threshold ?? snapThreshold : snapThreshold;
|
|
14735
14735
|
const effectiveSnapThreshold = resolvedSnapThreshold === void 0 || resolvedSnapThreshold < 0 ? Infinity : resolvedSnapThreshold;
|
|
14736
|
-
|
|
14736
|
+
useLayoutEffect(() => {
|
|
14737
14737
|
if (!initialScroll) return;
|
|
14738
14738
|
const allowAnimate = hasMountedRef.current;
|
|
14739
14739
|
if (snap && typeof snap === "object" && "positions" in snap) {
|
|
@@ -15048,12 +15048,10 @@ function ScrollView(props) {
|
|
|
15048
15048
|
};
|
|
15049
15049
|
const redraw = useRedraw();
|
|
15050
15050
|
const [visible, setVisible] = useState(false);
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15051
|
+
useLayoutEffect(() => {
|
|
15052
|
+
redraw();
|
|
15053
|
+
setVisible(true);
|
|
15054
15054
|
return () => {
|
|
15055
|
-
clearTimeout(timer1);
|
|
15056
|
-
clearTimeout(timer2);
|
|
15057
15055
|
if (wheelSnapTimeoutRef.current) {
|
|
15058
15056
|
clearTimeout(wheelSnapTimeoutRef.current);
|
|
15059
15057
|
}
|
|
@@ -15748,22 +15746,19 @@ function Joystick(props) {
|
|
|
15748
15746
|
const activeTweenRef = useRef(null);
|
|
15749
15747
|
const isDraggingRef = useRef(false);
|
|
15750
15748
|
const currentThumbPosRef = useRef({ x: 0, y: 0 });
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
if (
|
|
15760
|
-
|
|
15761
|
-
if (thumbRef.current != null) {
|
|
15762
|
-
thumbRef.current.setPosition(newCenter.x, newCenter.y);
|
|
15763
|
-
}
|
|
15749
|
+
useLayoutEffect(() => {
|
|
15750
|
+
const size2 = getLayoutSize(outerRef.current);
|
|
15751
|
+
if (size2 != null) {
|
|
15752
|
+
const newCenter = { x: size2.width / 2, y: size2.height / 2 };
|
|
15753
|
+
setCenter(newCenter);
|
|
15754
|
+
setSize({ width: size2.width, height: size2.height });
|
|
15755
|
+
if (!isDraggingRef.current && !activeTweenRef.current) {
|
|
15756
|
+
currentThumbPosRef.current = newCenter;
|
|
15757
|
+
if (thumbRef.current != null) {
|
|
15758
|
+
thumbRef.current.setPosition(newCenter.x, newCenter.y);
|
|
15764
15759
|
}
|
|
15765
15760
|
}
|
|
15766
|
-
}
|
|
15761
|
+
}
|
|
15767
15762
|
}, [outerRef]);
|
|
15768
15763
|
const themeType = props.joystickTheme?.theme;
|
|
15769
15764
|
const themeTint = props.joystickTheme?.tint;
|
|
@@ -15901,11 +15896,8 @@ function NineSliceButton(props) {
|
|
|
15901
15896
|
const ref = useRef(null);
|
|
15902
15897
|
const { applyEffect, stopEffects } = useGameObjectEffect(ref);
|
|
15903
15898
|
const [show, setShow] = useState(false);
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
return () => {
|
|
15907
|
-
clearTimeout(timer);
|
|
15908
|
-
};
|
|
15899
|
+
useLayoutEffect(() => {
|
|
15900
|
+
setShow(true);
|
|
15909
15901
|
}, []);
|
|
15910
15902
|
const innerWidth = (ref.current?.width ?? 0) - leftWidth - rightWidth;
|
|
15911
15903
|
const innerHeight = (ref.current?.height ?? 0) - (topHeight ?? 0) - (bottomHeight ?? 0);
|
|
@@ -15979,14 +15971,14 @@ function RefOriginView({
|
|
|
15979
15971
|
const handleOuterRef = (container) => {
|
|
15980
15972
|
if (!container) return;
|
|
15981
15973
|
outerRef.current = container;
|
|
15982
|
-
|
|
15974
|
+
getRenderContext(container.scene).deferLayout(() => {
|
|
15983
15975
|
const width2 = container.width;
|
|
15984
15976
|
const height2 = container.height;
|
|
15985
15977
|
const actualWidth = Number.isNaN(width2) ? 0 : width2;
|
|
15986
15978
|
const actualHeight = Number.isNaN(height2) ? 0 : height2;
|
|
15987
15979
|
if (actualHeight !== numericDimension.y || actualWidth !== numericDimension.x)
|
|
15988
15980
|
setNumericWidth({ x: actualWidth, y: actualHeight });
|
|
15989
|
-
}
|
|
15981
|
+
});
|
|
15990
15982
|
};
|
|
15991
15983
|
const pivotX = numericDimension.x * originX;
|
|
15992
15984
|
const pivotY = numericDimension.y * originY;
|
|
@@ -16406,11 +16398,13 @@ function BaseSlider(props) {
|
|
|
16406
16398
|
height: isHorizontal ? trackHeight : trackLength,
|
|
16407
16399
|
backgroundColor: themed.trackColor ?? 4473924,
|
|
16408
16400
|
cornerRadius: themed.trackBorderRadius ?? trackHeight / 2,
|
|
16401
|
+
alignItems: "start",
|
|
16402
|
+
padding: 0,
|
|
16409
16403
|
direction: "stack",
|
|
16410
16404
|
onTouch: handleTrackTouch,
|
|
16411
16405
|
theme: nestedTheme,
|
|
16412
16406
|
children: [
|
|
16413
|
-
props.renderTrack ? /* @__PURE__ */ jsxRuntime.jsx(View, { children: props.renderTrack(fillStartPercentage, isRange ? fillEndPercentage : void 0) }
|
|
16407
|
+
props.renderTrack ? /* @__PURE__ */ jsxRuntime.jsx(View, { children: props.renderTrack(fillStartPercentage, isRange ? fillEndPercentage : void 0) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
16414
16408
|
View,
|
|
16415
16409
|
{
|
|
16416
16410
|
x: isHorizontal ? fillStartPos : 0,
|
|
@@ -17086,6 +17080,7 @@ exports.releaseSVGTextures = releaseSVGTextures;
|
|
|
17086
17080
|
exports.remountAll = remountAll;
|
|
17087
17081
|
exports.resolveEffect = resolveEffect;
|
|
17088
17082
|
exports.resolveSize = resolveSize;
|
|
17083
|
+
exports.rgbToHsl = rgbToHsl;
|
|
17089
17084
|
exports.rgbToNumber = rgbToNumber;
|
|
17090
17085
|
exports.shallowEqual = shallowEqual;
|
|
17091
17086
|
exports.shouldComponentUpdate = shouldComponentUpdate;
|
|
@@ -17117,4 +17112,4 @@ exports.useViewportSize = useViewportSize;
|
|
|
17117
17112
|
exports.useWorldLayoutRect = useWorldLayoutRect;
|
|
17118
17113
|
exports.viewportRegistry = viewportRegistry;
|
|
17119
17114
|
exports.withHooks = withHooks;
|
|
17120
|
-
//# sourceMappingURL=TransformOriginView-
|
|
17115
|
+
//# sourceMappingURL=TransformOriginView-DsD_qZno.cjs.map
|