Kent Posted May 30, 2016 Share Posted May 30, 2016 I try to use dispose function to remove the 2d line when click the canvas, but seems not work. http://babylonjs-playground.com/#15C96V#2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2016 Share Posted May 30, 2016 Hi Kent, welcome to the forum... good to have you with us. Canvas2d is new, and I'm newbie... but I don't see any .removePrimitive() func on Canvas2d. That is what you are trying to do. You are attempting to remove only the "lines2d primitive" and not the entire canvas2D screenSpace, right? Maybe not possible at this time. But you can easily remove the entire canvas2d. http://babylonjs-playground.com/#15C96V#3 In lines 21-23, I renamed 'canvas' to 'screenSpace'. Less confusing. And in line 43... there it is, the screenSpace.dispose()... seems to work ok. Might work for your needs. Our 2D hero @Nockawa might come visit this thread and leave us with his wisdom. Hope this helps. Again, welcome, keep us posted. thx. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 30, 2016 Share Posted May 30, 2016 7 hours ago, Kent said: I try to use dispose function to remove the 2d line when click the canvas, but seems not work. http://babylonjs-playground.com/#15C96V#2 Hi @Kent thank you for your question, I've played with your PG and indeed, things should work and it's not. But, it's working on my machine, so I guess I've fixed the issue locally and it's not merged yet in the PG. I'm working hard to finish supporting the opaque/alphaTest/transparency and I'll commit things asap. In the time being, sorry for the inconvenience. A big thank to @Wingnut for dispatching! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 30, 2016 Share Posted May 30, 2016 Ok, weird thing...your playground is actually working on Internet Explorer, but not on FF or Chrome... But my local code is on both three webnav... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2016 Share Posted May 30, 2016 Hey, that's great customer service from @Nockawa... yay! http://babylonjs-playground.com/#272WI1#3 See the console and code line 45. var Canvas2D = function r() ? Weird. Cast-off your castings, Canvas2D. Come run with us... as an [object] Just talkin' crap, here, but I think that function r() is reasonably unhealthy. Thanks for your work, N! The demos from the docs are SWEEEET. I like 'em! http://babylonjs-playground.com/#15C96V (Off-topic, but, are we seeing some failed/intermittent clicks on the right two shape prims? I am. Just passing it along. Be well, guys.) Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 30, 2016 Share Posted May 30, 2016 2 minutes ago, Wingnut said: Hey, that's great customer service from @Nockawa... yay! http://babylonjs-playground.com/#272WI1#3 See the console and code line 45. var Canvas2D = function r() ? Weird. Cast-off your castings, Canvas2D. Come run with us... as an [object] Just talkin' crap, here, but I think that function r() is reasonably unhealthy. Thanks for your work, N! The demos from the docs are SWEEEET. I like 'em! http://babylonjs-playground.com/#15C96V (Off-topic, but, are we seeing some failed/intermittent clicks on the right two shape prims? I am. Just passing it along. Be well, guys.) I admit my JS skills are too limited to debug this PG if it's a JS issue, I'm a spoiled child doing TypeScript only! Concerning your off topic, no,you're right, intersection is supported actually only on the lines' element itself, not the cap (the square, round, arrow stuffs). I didn't have the time to do it yet! on more thing left to do! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2016 Share Posted May 30, 2016 ohhhhhh... ok. (duh, Wingy) Ok, cool, lines only, not fill-area, yet. Understood. Thanks! Hey, there's one way to get good at JS. Get in there and hack chow, baby. That's what the playground is for, right? SourceCode + rototiller = fun! Jump-in and hack away with the machete, hit RUN over and over. Why do it precise and tight... when you can do it with a chainsaw, right? heh Just havin' fun, as always. You see line 45 console.log(Canvas2D) report: function r() Right? Sure ya do. Canvas2d has a mis-casted type-mold. (huh?) (Like I know anything about TS) But... you know... Canvas2D was type-casted incorrectly for some reason. Should be an [object] (just like what line 46 reports) *shrug* Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 30, 2016 Share Posted May 30, 2016 Intersection on lines and fill area are supported, but not the Caps, the cap are the optional stuff you can stick at the start or end of the Lines2D shape. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Kent Posted May 31, 2016 Author Share Posted May 31, 2016 7 hours ago, Wingnut said: Hi Kent, welcome to the forum... good to have you with us. Canvas2d is new, and I'm newbie... but I don't see any .removePrimitive() func on Canvas2d. That is what you are trying to do. You are attempting to remove only the "lines2d primitive" and not the entire canvas2D screenSpace, right? Maybe not possible at this time. But you can easily remove the entire canvas2d. http://babylonjs-playground.com/#15C96V#3 In lines 21-23, I renamed 'canvas' to 'screenSpace'. Less confusing. And in line 43... there it is, the screenSpace.dispose()... seems to work ok. Might work for your needs. Our 2D hero @Nockawa might come visit this thread and leave us with his wisdom. Hope this helps. Again, welcome, keep us posted. thx. Thank you Wingnut. Yes, I want remove only the "lines2d primitive". I want create some dynamic 2d primitives on the screen, and remove one of them when some events happened, like the click event in the demo. Quote Link to comment Share on other sites More sharing options...
Kent Posted May 31, 2016 Author Share Posted May 31, 2016 8 hours ago, Nockawa said: Hi @Kent thank you for your question, I've played with your PG and indeed, things should work and it's not. But, it's working on my machine, so I guess I've fixed the issue locally and it's not merged yet in the PG. I'm working hard to finish supporting the opaque/alphaTest/transparency and I'll commit things asap. In the time being, sorry for the inconvenience. A big thank to @Wingnut for dispatching! Hi Nockawa, thank you for all your hard work. Looking forward to your updates Quote Link to comment Share on other sites More sharing options...
Kent Posted May 31, 2016 Author Share Posted May 31, 2016 9 hours ago, Nockawa said: Ok, weird thing...your playground is actually working on Internet Explorer, but not on FF or Chrome... But my local code is on both three webnav... Yes, I just tested, the IE worked fine, but the Chrome did not, maybe this is a browser compatibility issue. Because the http://babylonjs-playground.com/ website hard to open with IE in my country, so I always use the Chrome browser to test Babylonjs code. Sorry for missing the browser description in my question. 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.