@number10/phaserjsx 0.5.0 → 0.5.2

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 CHANGED
@@ -91,6 +91,8 @@ new Phaser.Game(config)
91
91
 
92
92
  [📖 Full Documentation](https://michael--.github.io/phaserjsx/)
93
93
 
94
+ [🎮 Live Examples on StackBlitz](https://stackblitz.com/@Michael--/collections/phaserjsx)
95
+
94
96
  See usage examples below for quick reference.
95
97
 
96
98
  ## 🎯 Examples
@@ -13362,6 +13362,7 @@ const widthCache = /* @__PURE__ */ new Map();
13362
13362
  function WrapText(props) {
13363
13363
  const localTheme = useTheme();
13364
13364
  const { props: themed } = getThemedProps("WrapText", localTheme, {});
13365
+ const scene = useScene();
13365
13366
  const wrap = props.wrap ?? themed.wrap ?? true;
13366
13367
  const paddingOffset = themed.paddingOffset ?? 0;
13367
13368
  const textKey = typeof props.text === "string" ? props.text : null;
@@ -13424,6 +13425,21 @@ function WrapText(props) {
13424
13425
  measureWidth(container);
13425
13426
  }
13426
13427
  }, [containerWidth, measureWidth, wrap]);
13428
+ useEffect(() => {
13429
+ if (!scene || !wrap) return;
13430
+ const handleResize = () => {
13431
+ const container = containerRef.current;
13432
+ if (container) {
13433
+ lastWidthRef.current = 0;
13434
+ setContainerWidth(0);
13435
+ measureWidth(container);
13436
+ }
13437
+ };
13438
+ scene.scale.on("resize", handleResize);
13439
+ return () => {
13440
+ scene.scale.off("resize", handleResize);
13441
+ };
13442
+ }, [scene, wrap, measureWidth]);
13427
13443
  useEffect(() => {
13428
13444
  return () => {
13429
13445
  if (measureRafRef.current !== null) {
@@ -17101,4 +17117,4 @@ exports.useViewportSize = useViewportSize;
17101
17117
  exports.useWorldLayoutRect = useWorldLayoutRect;
17102
17118
  exports.viewportRegistry = viewportRegistry;
17103
17119
  exports.withHooks = withHooks;
17104
- //# sourceMappingURL=TransformOriginView-DyhDBexY.cjs.map
17120
+ //# sourceMappingURL=TransformOriginView-2QSoN8wM.cjs.map