| | |
| | | height: window.innerHeight, |
| | | }); |
| | | |
| | | let mapContainer = new PIXI.Container(); |
| | | mapContainer.name = "mapContainer"; |
| | | mapContainer.data = {}; |
| | | app.stage.addChild(mapContainer); |
| | | |
| | | React.useEffect(() => { |
| | | const handleResize = () => { |
| | | setWindowSize({ |
| | |
| | | app.stage.hitArea = app.screen; |
| | | globalThis.__PIXI_APP__ = app; |
| | | mapRef.current.appendChild(app.view); |
| | | |
| | | // mapContainer ------------------------------ |
| | | const mapContainer = new PIXI.Container(); |
| | | mapContainer.name = "mapContainer"; |
| | | mapContainer.data = {}; |
| | | app.stage.addChild(mapContainer); |
| | | |
| | | const texture = PIXI.Texture.from('https://pixijs.com/assets/bunny.png'); |
| | | const bunny = new PIXI.Sprite(texture); |
| | |
| | | setEditModalVisible(true); |
| | | } |
| | | |
| | | const onDrop = (x, y) => { |
| | | const bunny = PIXI.Sprite.from('https://pixijs.io/examples/examples/assets/bunny.png'); |
| | | bunny.anchor.set(0.5); |
| | | bunny.x = x; |
| | | bunny.y = y; |
| | | app.stage.addChild(bunny); |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Layout className={styles.layout}> |
| | |
| | | } |
| | | } |
| | | refCurr={mapRef.current} |
| | | onDrop={onDrop} |
| | | /> |
| | | </> |
| | | ) |