mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-27 01:40:52 +01:00
Fix some floating positions
This commit is contained in:
parent
d060d3f3b6
commit
19779eb2e2
@ -221,7 +221,8 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
|
||||
point.x += avatarCanvas.regPoint.x;
|
||||
point.y += avatarCanvas.regPoint.y;
|
||||
|
||||
partContainer.position.set(point.x, point.y);
|
||||
partContainer.x = Math.floor(point.x);
|
||||
partContainer.y = Math.floor(point.y);
|
||||
|
||||
container.addChild(partContainer);
|
||||
}
|
||||
@ -282,8 +283,6 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
|
||||
|
||||
if(!this._activeTexture) return null;
|
||||
|
||||
this._activeTexture.source.scaleMode = 'nearest';
|
||||
|
||||
const container = this.buildAvatarContainer(avatarCanvas, setType);
|
||||
|
||||
GetRenderer().render({
|
||||
|
@ -73,7 +73,8 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur
|
||||
|
||||
sprite.setFromMatrix(matrix);
|
||||
|
||||
sprite.position.set(0);
|
||||
sprite.x = 0;
|
||||
sprite.y = 0;
|
||||
|
||||
return TextureUtils.generateTexture(sprite);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IAssetData, IAssetVisualizationData, IObjectVisualizationData } from '@nitrots/api';
|
||||
import { BLEND_MODES } from 'pixi.js';
|
||||
import { RoomGeometry } from '../../../utils';
|
||||
import { ColorData, LayerData, SizeData } from '../data';
|
||||
|
||||
export class FurnitureVisualizationData implements IObjectVisualizationData
|
||||
@ -105,11 +106,33 @@ export class FurnitureVisualizationData implements IObjectVisualizationData
|
||||
this._sizes.push(size);
|
||||
}
|
||||
|
||||
this.removeInvalidSizes();
|
||||
|
||||
this._sizes.sort();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private removeInvalidSizes(): void
|
||||
{
|
||||
if(!this._sizes || !this._sizes.length) return;
|
||||
|
||||
const zoomedIn = this._sizeDatas.get(RoomGeometry.SCALE_ZOOMED_IN);
|
||||
const zoomedOut = this._sizeDatas.get(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
if(zoomedIn && zoomedOut)
|
||||
{
|
||||
if(zoomedIn.layerCount !== zoomedOut.layerCount)
|
||||
{
|
||||
this._sizeDatas.delete(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
const index = this._sizes.indexOf(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
if(index >= 0) this._sizes.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean
|
||||
{
|
||||
if(!sizeData || !key || !data) return false;
|
||||
|
@ -105,7 +105,8 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
||||
const offsetX = ((background.width - sprite.width) / 2);
|
||||
const offsetY = ((background.height - sprite.height) / 2);
|
||||
|
||||
sprite.position.set(offsetX, offsetY);
|
||||
sprite.x = Math.floor(offsetX);
|
||||
sprite.y = Math.floor(offsetY);
|
||||
|
||||
container.addChild(background, sprite);
|
||||
|
||||
|
@ -266,7 +266,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY))
|
||||
{
|
||||
this._display.position.set(this._screenOffsetX, this._screenOffsetY);
|
||||
this._display.x = Math.floor(this._screenOffsetX);
|
||||
this._display.y = Math.floor(this._screenOffsetY);
|
||||
|
||||
update = true;
|
||||
}
|
||||
@ -562,8 +563,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
||||
}
|
||||
|
||||
if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
extendedSprite.x = Math.round(sprite.x);
|
||||
extendedSprite.y = Math.round(sprite.y);
|
||||
|
||||
extendedSprite.offsetX = objectSprite.offsetX;
|
||||
extendedSprite.offsetY = objectSprite.offsetY;
|
||||
|
Loading…
Reference in New Issue
Block a user