excelsior Posted May 19, 2016 Share Posted May 19, 2016 Hey so i'm trying to display text when the cursor over a mesh with canvas 2D. So the text appear okay but now when the cursor leave the mesh i want the text de disapear ? how can i do that is there some kind of clear rect methods on a 2D canvas ? Quote Link to comment Share on other sites More sharing options...
excelsior Posted May 19, 2016 Author Share Posted May 19, 2016 i found a solution doing canvas2.children[1].text = '' Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 19, 2016 Share Posted May 19, 2016 Just change the levelVisible setting to true or false to display/hide your text. Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 20, 2016 Share Posted May 20, 2016 Ah - I think @excelsior has an excellent question. How to hide the entire 2D canvas (all elements) without a .dispose operation clearing all elements from memory. I'm going to guess that there are several obvious answers to this, however what is the most efficient way to hide the entire 2D canvas without diposing of the canvas from memory cache? DB Quote Link to comment Share on other sites More sharing options...
Nockawa Posted May 21, 2016 Share Posted May 21, 2016 20 hours ago, dbawel said: Ah - I think @excelsior has an excellent question. How to hide the entire 2D canvas (all elements) without a .dispose operation clearing all elements from memory. I'm going to guess that there are several obvious answers to this, however what is the most efficient way to hide the entire 2D canvas without diposing of the canvas from memory cache? DB You have two properties: levelVisible: if you set it to false, the primitive and its content will be hidden. You can set it on the Canvas, because the Canvas is also a primitive. isVisible: this property let you know if the primitive is visible or not. Because if a given primitive has levelVisible to true but one of its parent has its levelVisible to false, the primitive will be hidden. So you can't rely on levelVisible to get the actual visible state. Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 21, 2016 Share Posted May 21, 2016 @Nockawa - I use these for meshes, materials, etc., but are you saying that I can use these as a single operation to set the visibility of an entire canvas collectively in Javascript and not HTML? If so, this is not something I was aware of, and would be quite useful for any canvas I might initiate. Not only a 2D canvas? Thanks, DB Quote Link to comment Share on other sites More sharing options...
JohnK Posted May 21, 2016 Share Posted May 21, 2016 @dbawel not sure that you have noted that canvas2D refers to a new construct created by Nockawa for BJS and not the HTML canvas. If not then check out If you have noted then my apologies for the unnecessary interruption. dbawel 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 21, 2016 Share Posted May 21, 2016 @JohnK - I had not considered this - so thank you very much for pointing out what I missed in translation. It must be getting late for you now, so have a great evening and rest of your weekend. Cheers, DB 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.