fix: ECS size change
This commit is contained in:
parent
df0e012338
commit
c27ab133a9
|
@ -12,8 +12,27 @@ import {CHUNK_SIZE, RESOLUTION} from '@/util/constants.js';
|
|||
import {deferredLighting} from './lights.js';
|
||||
|
||||
const TileLayerInternal = PixiComponent('TileLayer', {
|
||||
create: ({group, tileLayer}) => {
|
||||
create: () => {
|
||||
const container = new Container();
|
||||
return container;
|
||||
},
|
||||
applyProps: (container, {tileLayer: oldTileLayer}, props) => {
|
||||
const {asset, group, renderer, tileLayer} = props;
|
||||
const extless = tileLayer.source.slice('/assets/'.length, -'.json'.length);
|
||||
const {textures} = asset;
|
||||
if (tileLayer === oldTileLayer) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!oldTileLayer
|
||||
|| (
|
||||
oldTileLayer.area.x !== tileLayer.area.x
|
||||
|| oldTileLayer.area.y !== tileLayer.area.y
|
||||
|| oldTileLayer.tileSize.x !== tileLayer.tileSize.x
|
||||
|| oldTileLayer.tileSize.y !== tileLayer.tileSize.y
|
||||
)
|
||||
) {
|
||||
container.removeChildren();
|
||||
const {area, tileSize} = tileLayer;
|
||||
const g = new Graphics();
|
||||
g.beginFill(group === deferredLighting.diffuseGroup ? 0x000000 : 0x7777ff);
|
||||
|
@ -61,14 +80,6 @@ const TileLayerInternal = PixiComponent('TileLayer', {
|
|||
container.addChild(sprite);
|
||||
}
|
||||
}
|
||||
return container;
|
||||
},
|
||||
applyProps: (container, {tileLayer: oldTileLayer}, props) => {
|
||||
const {asset, group, renderer, tileLayer} = props;
|
||||
const extless = tileLayer.source.slice('/assets/'.length, -'.json'.length);
|
||||
const {textures} = asset;
|
||||
if (tileLayer === oldTileLayer) {
|
||||
return;
|
||||
}
|
||||
for (const i in tileLayer.$$chunks) {
|
||||
if (!oldTileLayer || oldTileLayer.$$chunks[i] !== tileLayer.$$chunks[i]) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user