pixi-fusion 1.0.0 → 1.0.1

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.
@@ -30,16 +30,24 @@ export const World = ({ children, eventMode, size }) => {
30
30
  };
31
31
  }, [size, canvasRef, isInitialized]);
32
32
  useEffect(() => {
33
- if (canvasRef.current && !isInitialized) {
33
+ if (!isInitialized) {
34
34
  application.current
35
- .init({
36
- resizeTo: canvasRef.current
37
- })
35
+ .init()
38
36
  .then(() => {
39
37
  setIsInitialized(true);
38
+ })
39
+ .catch((e) => {
40
+ setIsInitialized(true);
41
+ console.error(e);
40
42
  });
41
43
  }
42
44
  }, [canvasRef.current, isInitialized]);
45
+ useEffect(() => {
46
+ if (isInitialized && canvasRef.current) {
47
+ application.current.resizeTo = canvasRef.current;
48
+ application.current.resize();
49
+ }
50
+ }, [canvasRef.current, isInitialized]);
43
51
  const conextValue = useMemo(() => ({
44
52
  application: application.current,
45
53
  size: worldSize,
package/package.json CHANGED
@@ -47,6 +47,6 @@
47
47
  "build": "tsc",
48
48
  "build:dev": "tsc -w"
49
49
  },
50
- "version": "1.0.0",
50
+ "version": "1.0.1",
51
51
  "webpack": "./src/index.ts"
52
52
  }
@@ -44,17 +44,26 @@ export const World: React.FC<PropsWithChildren & WorldProps> = ({ children, even
44
44
  }, [size, canvasRef, isInitialized]);
45
45
 
46
46
  useEffect(() => {
47
- if (canvasRef.current && !isInitialized) {
47
+ if (!isInitialized) {
48
48
  application.current
49
- .init({
50
- resizeTo: canvasRef.current
51
- })
49
+ .init()
52
50
  .then(() => {
53
51
  setIsInitialized(true);
52
+ })
53
+ .catch((e) => {
54
+ setIsInitialized(true);
55
+ console.error(e);
54
56
  });
55
57
  }
56
58
  }, [canvasRef.current, isInitialized]);
57
59
 
60
+ useEffect(() => {
61
+ if (isInitialized && canvasRef.current) {
62
+ application.current.resizeTo = canvasRef.current;
63
+ application.current.resize();
64
+ }
65
+ }, [canvasRef.current, isInitialized]);
66
+
58
67
  const conextValue = useMemo<WorldContextValue>(
59
68
  () => ({
60
69
  application: application.current,