Devb93 Posted February 18, 2019 Share Posted February 18, 2019 What would be the best way to go about making containers/objects draggable without having to add the code for every single individual object/container I've been researching, but hitting a roadblock. I know it likely would utilize bubbling/interaction manager in some way to do so with listeners. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 18, 2019 Share Posted February 18, 2019 I don't understand the problem How do you want to choose which object to move : the one that mouse is above or its parent? PixiJS scene isn't suited for that kind of stuff, its not DOM. If you set rules for it, maybe you can do it on pixi stuff, but if you want everything to be dragged, its possible that you need your own scene or at least interaction manager. Also most of the best solutions are game-dependant and users dont share them, its not strange that you cant find them, most people cant their codebase. If something does not appear in search, that doesnt mean its very difficult, its just .. maybe everyone does it on its own just in a few hours time and then forgets it, and nobody cares enough to make good demos for it. There are global listeners in InteractionManager if you need it (in renderer.interaction stuff) Here's full code for interaction manager: https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/src/InteractionManager.js ,the main algo t is in `processInteractive ` method. Quote Link to comment Share on other sites More sharing options...
botmaster Posted February 18, 2019 Share Posted February 18, 2019 I work with Typescript and I simply have a base class that allows dragging with: startDragging(rect:Rectangle, center:boolean) and stopDragging(). Doing that kind of stuff with Typescript is easy, with javascript it's more tricky. 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.