From b152053d189b5b88b7e1159202f371743d75cb84 Mon Sep 17 00:00:00 2001 From: logsol Date: Fri, 26 Dec 2014 23:53:44 +0100 Subject: [PATCH] fixed fullscreen swiper --- app/Game/Client/View/Pixi/Layer.js | 15 +++++++++------ app/Game/Client/View/Pixi/Layers/Swiper.js | 4 +++- app/Game/Client/View/Pixi/View.js | 3 +-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/Game/Client/View/Pixi/Layer.js b/app/Game/Client/View/Pixi/Layer.js index f9a996d..d8582bd 100644 --- a/app/Game/Client/View/Pixi/Layer.js +++ b/app/Game/Client/View/Pixi/Layer.js @@ -21,6 +21,7 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings) { this.container = new PIXI.DisplayObjectContainer(); this.container.x = 0; this.container.y = 0; + this.static = false; } Layer.prototype = Object.create(Parent.prototype); @@ -166,13 +167,15 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings) { this.container.scale.y = this.container.scale.x; // Position - var posXStep = (this.position.target.x - this.position.current.x) * Settings.CAMERA_GLIDE / 100; - this.position.current.x += posXStep; - this.container.x = this.position.current.x + (this.position.current.x * this.parallaxSpeed); + if (!this.static) { + var posXStep = (this.position.target.x - this.position.current.x) * Settings.CAMERA_GLIDE / 100; + this.position.current.x += posXStep; + this.container.x = this.position.current.x + (this.position.current.x * this.parallaxSpeed); - var posYStep = (this.position.target.y - this.position.current.y) * Settings.CAMERA_GLIDE / 100; - this.position.current.y += posYStep; - this.container.y = this.position.current.y + (this.position.current.y * this.parallaxSpeed); + var posYStep = (this.position.target.y - this.position.current.y) * Settings.CAMERA_GLIDE / 100; + this.position.current.y += posYStep; + this.container.y = this.position.current.y + (this.position.current.y * this.parallaxSpeed); + } }; return Layer; diff --git a/app/Game/Client/View/Pixi/Layers/Swiper.js b/app/Game/Client/View/Pixi/Layers/Swiper.js index 2d6f185..68d5769 100644 --- a/app/Game/Client/View/Pixi/Layers/Swiper.js +++ b/app/Game/Client/View/Pixi/Layers/Swiper.js @@ -8,7 +8,9 @@ define([ function (Parent, PIXI, Nc, Settings) { function Swiper() { - Parent.call(this, "ghost", 0); + Parent.call(this, "swiper", 0); + + this.static = true; this.ncTokens = [ Nc.on(Nc.ns.client.view.swiper.swipe, this.swipe, this), diff --git a/app/Game/Client/View/Pixi/View.js b/app/Game/Client/View/Pixi/View.js index 02af094..2f4a08b 100755 --- a/app/Game/Client/View/Pixi/View.js +++ b/app/Game/Client/View/Pixi/View.js @@ -74,8 +74,7 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer this.layerManager.insert(this.ghostLayer, false); this.swiperLayer = new Swiper(); - this.stage.addChild(this.swiperLayer.getContainer()); - //this.layerManager.insert(this.swiperLayer, false); + this.layerManager.insert(this.swiperLayer, false); } PixiView.prototype.render = function () {