gtspina Posted October 14, 2017 Share Posted October 14, 2017 Hi guys. I'm trying to do a "zoom in" effect on a GUI_Object. But when scaling the image leaves the original collision field. How to keep the image centered with the collision field of the button? Before click: After click: Code: game.UI.ButtonInit = me.GUI_Object.extend({ init: function (x, y, image) { this._super(me.GUI_Object, "init", [x, y, { image: image, }]); this.anchorPoint.set(0, 0); this.floating = false; }, onClick: function () { this._super(me.Sprite, "scale", [.8, .8]); }, update: function () { return true; }, draw: function (renderer) { this._super(me.GUI_Object, "draw", [renderer]); } }); Quote Link to comment Share on other sites More sharing options...
Parasyte Posted October 16, 2017 Share Posted October 16, 2017 If you are using the collision shapes for pointer events, you can create a plugin to patch me.input.globalToLocal() to apply the same scaling transformation. This won't make the debugPanel render the collision shapes scaled, but your plugin could also patch the debugPanel's draw method to apply the scaling transformation, if you needed to. If, however, you aren't using pointer events, why would you want to scale the collision shapes at all? Quote Link to comment Share on other sites More sharing options...
cubemoon Posted November 24, 2017 Share Posted November 24, 2017 I also have the same problem The question is, why did the position of the game.UI.ButtonInit change? Quote Link to comment Share on other sites More sharing options...
obiot Posted January 1, 2018 Share Posted January 1, 2018 this should be fixed in the latest dev branch (-> 5.1 to be released within a few days), here an link to the latest build : https://melonjs-builds.s3.amazonaws.com/index.html?prefix=artifacts/master/2120/build/ make sure to also update the debugPanel to the latest version if you want to give it a try before the release : https://github.com/melonjs/melonJS/tree/master/plugins/debug gtspina 1 Quote Link to comment Share on other sites More sharing options...
sistemlogikadigital Posted January 6, 2019 Share Posted January 6, 2019 i thinks this is still not fixed var scale = { mul : 1, } this.TweenScale = new me.Tween(scale).to({mul:1.01}, 500). onUpdate(()=>{ this.scale(scale.mul, scale.mul); }); this.TweenScale.easing(me.Tween.Easing.Quadratic.Out); this.TweenScale.start(); here is the result, see the big purple circle, when scaling its position changed Quote Link to comment Share on other sites More sharing options...
sistemlogikadigital Posted January 13, 2019 Share Posted January 13, 2019 @obiot is there an update about this? Quote Link to comment Share on other sites More sharing options...
obiot Posted January 15, 2019 Share Posted January 15, 2019 sorry man, I did not have the time on my side to look at it yet.... but if you are up to it, I'll be super happy to integrate/merge any proposition for improvements Quote Link to comment Share on other sites More sharing options...
Dan K Posted March 9, 2019 Share Posted March 9, 2019 Oliver, Look at my branch push... I think that might fix this... 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.