From d5356d8186d483b484242f1fb57f458e4f046744 Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 25 Mar 2019 19:02:30 -0500 Subject: [PATCH] feat: Scaling --- packages/graphics/index.js | 6 ++++++ packages/graphics/shape-view.js | 4 ++-- packages/physics/body-view.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/graphics/index.js b/packages/graphics/index.js index c26658e..868aca6 100644 --- a/packages/graphics/index.js +++ b/packages/graphics/index.js @@ -1,3 +1,5 @@ +const PIXI = 'undefined' !== typeof window ? require('pixi.js') : undefined; + export {AnimationView} from './animation-view'; export {Color} from './color'; export {Container} from './container'; @@ -8,3 +10,7 @@ export {Renderable} from './renderable'; export {Renderer} from './renderer'; export {ShapeView} from './shape-view'; export {Sprite} from './sprite'; + +if (PIXI) { + PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST +} diff --git a/packages/graphics/shape-view.js b/packages/graphics/shape-view.js index 42f14f7..906e84a 100644 --- a/packages/graphics/shape-view.js +++ b/packages/graphics/shape-view.js @@ -45,7 +45,7 @@ export class ShapeView extends Renderable { primitives.drawLine( lastVertice, vertice, - Primitives.lineStyle(new Color(255, 0, 255), 4), + Primitives.lineStyle(new Color(255, 0, 255), 1), ); } lastVertice = vertice; @@ -53,7 +53,7 @@ export class ShapeView extends Renderable { primitives.drawLine( lastVertice, firstVertice, - Primitives.lineStyle(new Color(255, 0, 255), 4), + Primitives.lineStyle(new Color(255, 0, 255), 1), ); this.container.removeAllChildren(); this.container.addChild(primitives); diff --git a/packages/physics/body-view.js b/packages/physics/body-view.js index 663e095..e0a2aee 100644 --- a/packages/physics/body-view.js +++ b/packages/physics/body-view.js @@ -21,13 +21,13 @@ export class BodyView extends Renderable { this.primitives.drawLine( [xMiddle, aabb[1]], [xMiddle, aabb[1] + (aabb[3] - 0.0001)], - Primitives.lineStyle(new Color(255, 255, 0), 4) + Primitives.lineStyle(new Color(255, 255, 0), 1) ); const yMiddle = aabb[1] + (aabb[3] / 2); this.primitives.drawLine( [aabb[0], yMiddle], [aabb[0] + (aabb[2] -0.0001), yMiddle], - Primitives.lineStyle(new Color(255, 255, 0), 4) + Primitives.lineStyle(new Color(255, 255, 0), 1) ); }