CamO Posted July 5, 2020 Share Posted July 5, 2020 @Aaron McGuire you are just drawing on top of a graphic its not modifying the existing one. @ivan.popelyshevHas anyone found a solution to this i need it to move graphic border to new graphic point coordinate dynamically Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 5, 2020 Share Posted July 5, 2020 Shame on you, necro-ing very old thread. There were threads like that not long ago, its possible but requires full invalidation of p[ixi v5 graphics object. You have to manually change "graphics.geometry.graphicsData" and call "graphics.geometry.invalidate()" . Note, that all the performance problems wil be your fault. Use spectorJS to debug, separate multiple graphics into several instances e.t.c. i really cant put it all in one message, its a very big topic. Quote Link to comment Share on other sites More sharing options...
CamO Posted July 5, 2020 Share Posted July 5, 2020 (edited) @ivan.popelyshev i dont know what necro-ing is and i dont know why im getting insulted but im sure that this doesnt feel welcoming at all. If the issue is personal feel free to elaborate. All i asked was a question. by the way i did justify that a so given solution wasnt really a solution here Edited July 5, 2020 by CamO Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 5, 2020 Share Posted July 5, 2020 Necro-posting is making a comment to very old thread, its fine on stackoverflow, but on forums like that, when we switched 2 major versions of pixi after 2014, its better to create new one. Oh, right, previous message was at 2019 year, not so necro. so, why the answer in isn't enough? Quote Link to comment Share on other sites More sharing options...
CamO Posted July 6, 2020 Share Posted July 6, 2020 (edited) Not really, unless I have missed something. Really all i am looking to do are 2 things: 1) when moving polygon point that the same goes for the lineStyle points dynamically (btw I am using vertexData to move change the points of the polygon) 2) to change the fill of the lineStyle when clicking on a button Edited July 6, 2020 by CamO Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 6, 2020 Share Posted July 6, 2020 vertexData works only if graphics is small and it was detected as "batchable" (see the source of Graphics and GraphicsGeometry). You should change insides of `graphics.geometry.graphicsData` or something easy like that: let myPoly = new Polygon(...); graphics.drawPolygon(myPoly); myPoly.points[0] = ... //change something graphics.geometry.invalidate(); lineStyle gets copied so you cant just use it and then change - you have to look inside `graphics.geometry.graphicsData[0]`. My earlier demo should work for you. All those problems are here because Graphics originally was created to be cleared&refilled. Quote Link to comment Share on other sites More sharing options...
CamO Posted July 7, 2020 Share Posted July 7, 2020 @ivan.popelyshev hey Ivan i just want to confirm that i hav the correct demo i have been playing with it for a couple of day, is this thhe link: https://www.pixiplayground.com/#/edit/GYy0QCPK1I62IyCxr2WH1 ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 8, 2020 Share Posted July 8, 2020 nope, someone rewrote demo by the link, we dont have auth system there. Here you go: https://www.pixiplayground.com/#/edit/uXGVLX0wynNmJWIix5gn4 Quote Link to comment Share on other sites More sharing options...
CamO Posted July 10, 2020 Share Posted July 10, 2020 @ivan.popelyshev Hi Ivan i just wanted to tell you that it is working, thank you for your help ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
JoakimL Posted August 29, 2022 Share Posted August 29, 2022 PIXI.Graphics.prototype.updateLineStyle = function({width=null, color=null, alpha=null}={}) { this.geometry.graphicsData.forEach(data => { if (width!=null) { data.lineStyle.width = width; } if (color!=null) { data.lineStyle.color = color; } if (alpha!=null) { data.lineStyle.alpha = alpha; } }); this.geometry.invalidate(); } graphics_object.updateLineStyle({color:"0xff00ff"}); 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.