MrB Posted May 17, 2014 Share Posted May 17, 2014 Pretty straight forward problem, but I haven't figured out how to solve it. I have something like this:...graphics = new PIXI.Graphics();graphics.lineStyle(styles[s].lineWidth, styles[s].lineColor, p.active);graphics.beginFill(styles[s].fillColor, styles[s].fillAlpha);graphics.drawCircle(0,0, p.w/styles[s].radius);graphics.position.x = p.x+size/2;graphics.position.y = p.y+size/2;stage.addChild(graphics);shapes[flower][p.index][s] = graphics;...And then later I try to change the radius like so:...shapes[flower][p.index][s].currentPath.points[2] = p.w/styles[s].radius;shapes[flower][p.index][s].currentPath.points[3] = p.w/styles[s].radius;...Where the value of p.w has changed and therefor the radius should change but it doesn't, perhaps because I'm not suppose to be editing .currentPath to change the radius. So how do I change the radius? Quote Link to comment Share on other sites More sharing options...
MrB Posted May 17, 2014 Author Share Posted May 17, 2014 Maybe I'm misunderstanding the API, perhaps the correct way is not to create a graphic and then alter it's properties, but to have my new properties ready and then just draw the graphic again by using .clear() and calling the drawing calls again. So on each update I do:shapes[flower][p.index][s].clear();shapes[flower][p.index][s].lineStyle(styles[s].lineWidth, lineColor, lineAlpha);shapes[flower][p.index][s].beginFill(fillColor, styles[s].fillAlpha);shapes[flower][p.index][s].drawCircle(0,0, p.w/styles[s].radius);shapes[flower][p.index][s].position.x = p.x+size/2;shapes[flower][p.index][s].position.y = p.y+size/2;shapes[flower][p.index][s].alpha = p.active; Quote Link to comment Share on other sites More sharing options...
xerver Posted May 18, 2014 Share Posted May 18, 2014 Maybe I'm misunderstanding the API, perhaps the correct way is not to create a graphic and then alter it's properties, but to have my new properties ready and then just draw the graphic again by using .clear() and calling the drawing calls again. That is correct, you should just make use of the drawing APIs. I wouldn't worry about trying to modify the path, let the object do that for you. Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted March 30, 2016 Share Posted March 30, 2016 I am about to edit points of a polygon on mousemove but no luck, Can anyone please help? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 30, 2016 Share Posted March 30, 2016 Where exactly do you store that polygon? Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted March 31, 2016 Share Posted March 31, 2016 It happens when I try to zoom the stage from the very center of the canvas. I think it is happening so because the stage doesn't get zoomed from the very center. So if I can zoom the entire stage from the canvas center, events may start normally. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 31, 2016 Share Posted March 31, 2016 InteractionManager knows about all your transforms, positions and scales. Please use it: http://pixijs.github.io/examples/index.html?s=demos&f=dragging.js&title=Dragging 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.