mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 14:36:26 +01:00
Pixi v7 works
This commit is contained in:
parent
346b2092b4
commit
5c8f39ec1e
@ -63,7 +63,6 @@ export class Nitro implements INitro
|
||||
autoDensity: false,
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
resolution: window.devicePixelRatio,
|
||||
view: canvas
|
||||
});
|
||||
}
|
||||
|
@ -396,12 +396,6 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
if(((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength)))
|
||||
{
|
||||
console.log('found plane', `
|
||||
tileX: ${ tileX }
|
||||
tileY: ${ tileY }
|
||||
tileZ: ${ tileZ }
|
||||
leftSideLength: ${ leftSideLength }
|
||||
rightSideLength: ${ rightSideLength }`);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, tileZ);
|
||||
@ -409,12 +403,6 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('no found plane', `
|
||||
tileX: ${ tileX }
|
||||
tileY: ${ tileY }
|
||||
tileZ: ${ tileZ }
|
||||
leftSideLength: ${ leftSideLength }
|
||||
rightSideLength: ${ rightSideLength }`);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0);
|
||||
|
||||
return;
|
||||
|
@ -829,7 +829,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const extendedSprite = this.getExtendedSprite(spriteId);
|
||||
|
||||
if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
if(extendedSprite && extendedSprite.containsPixelPerfectPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
{
|
||||
if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||
{
|
||||
|
@ -65,26 +65,24 @@ export class ExtendedSprite extends Sprite
|
||||
|
||||
public containsPoint(point: Point): boolean
|
||||
{
|
||||
return ExtendedSprite.containsPoint(this, point);
|
||||
return this.containsPixelPerfectPoint(point);
|
||||
}
|
||||
|
||||
public static containsPoint(sprite: ExtendedSprite, point: Point): boolean
|
||||
public containsPixelPerfectPoint(point: Point): boolean
|
||||
{
|
||||
if(!sprite || !point || (sprite.alphaTolerance > 255)) return false;
|
||||
if(!point || (this.alphaTolerance > 255)) return false;
|
||||
|
||||
if(!(sprite instanceof Sprite)) return false;
|
||||
if((this.texture === Texture.EMPTY) || (this.blendMode !== BLEND_MODES.NORMAL)) return;
|
||||
|
||||
if((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return;
|
||||
|
||||
const texture = sprite.texture;
|
||||
const texture = this.texture;
|
||||
const baseTexture = texture.baseTexture;
|
||||
|
||||
if(!texture || !baseTexture || !baseTexture.valid) return false;
|
||||
|
||||
const x = (point.x * sprite.scale.x);
|
||||
const y = (point.y * sprite.scale.y);
|
||||
const x = (point.x * this.scale.x);
|
||||
const y = (point.y * this.scale.y);
|
||||
|
||||
if(!sprite.getLocalBounds().contains(x, y)) return false;
|
||||
if(!this.getLocalBounds().contains(x, y)) return false;
|
||||
|
||||
//@ts-ignore
|
||||
if(!baseTexture.hitMap)
|
||||
|
Loading…
Reference in New Issue
Block a user