inductible Posted August 21, 2013 Share Posted August 21, 2013 Hey guys, is there any know weirdness with 'scale' property of a DisplayObject, and InteractionmManager? I'm targeting canvas renderer only - no WebGL rendering here. My resize handler does the following: - scales the stage based on the new width and height (thought this seems to have no effect on any child DisplayObjects!?): var sx:number = w / this.config.stageW ;var sy:number = h / this.config.stageH ;stage.scale.x = sx;stage.scale.y = sy; - resizes the renderer: renderer.resize( w, h ) ; - because stage scale seems not to function as I'd expect, I try propagating the scale into my current view object this.scale.x = sx ;this.scale.y = sy; - This latter step correctly sizes the view, but my interactive objects are now screwed because the hitTest no longer appears to work (functional hit area is no longer coupled to where the scaled object appears to be)... Am I missing something obvious? Quote Link to comment Share on other sites More sharing options...
Markus Posted August 21, 2013 Share Posted August 21, 2013 Hi, i had same Problem and solve this with changing scale 4 all children of the stage. Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted August 21, 2013 Share Posted August 21, 2013 Hi there! The stage cannot be scaled as its the root object. The best thing to do is to add all of your content into a displayObjectContainer then you can then scale that. Something like this:var gameContainer = new PIXI.DisplayObjectContainer();//add content to game container..stage.addChild(gameContainer)onResize = function(){ gameContainer.scale.x = newXScale; gameContainer.scale.y = newYScale;} Hope that helps! inductible 1 Quote Link to comment Share on other sites More sharing options...
inductible Posted August 22, 2013 Author Share Posted August 22, 2013 Cool thanks for the advice! And the interaction manager should work correctly 'out of the box' for scaled objects? I'll investigate again today with a root DObjContainer that isn't stage. Quote Link to comment Share on other sites More sharing options...
inductible Posted August 22, 2013 Author Share Posted August 22, 2013 I'm now using a root container object, which is a simple solution to to stage scalability (I was misled by 'stage' inheriting from DisplayObjectContainer, which obviously exposes a 'scale' property which does nowt!). Interaction still seems borked though for scaled objects though - mayhaps this is a bug? Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted August 22, 2013 Share Posted August 22, 2013 Yeah, my bad on that. I think I will set the scale properties of stage so that it will let the users know that scale will not be applied. With regards to the interactionManager, it should work out of the box with scaled objects. Would you mind sharing you code so I can take a peek at what might be going wrong? Cheers! Quote Link to comment Share on other sites More sharing options...
inductible Posted August 22, 2013 Author Share Posted August 22, 2013 It looks like it does indeed work out of the box - it's my own implementation that is causing issues: I'm working on it now, but it would appear that my having nested interactibles may be the cause... I have a 'scene view' object, which is interactive [setInteractive(true)], and manages some functionality on touchstart, touchmove and touchend (it's a drawing application). This scene view contains a number of buttons, which are also interactive [setInteractive(true)] - the location of the hitareas on these buttons is way off. If I don't make the scene view interactive, my buttons are fine. I have a workaround (yet to implement it), which is to simply create a DisplayObject 'touch zone' to handle my drawing events, rather than utilising the container view. Quote Link to comment Share on other sites More sharing options...
inductible Posted August 22, 2013 Author Share Posted August 22, 2013 Yeah that 'workaround' totally owned it. I'm now simply using a relevant background image (Sprite) as the touch recipient. Lesson learned: don't use an abstract container as a touch recipient - make a dedicated view instead! I'm truly surfing with PIXI now, thanks kindly Mat, and keep up the ace work Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted August 22, 2013 Share Posted August 22, 2013 No worries, happy to be of use Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.