Remove warning icon make a rendering bug

40 views
Skip to first unread message

pigeonmaléfique

unread,
Nov 2, 2021, 10:51:11 AM11/2/21
to Blockly
Hi, I have a little code that puts an warning icon :
block.setWarningText("Warn");

And for remove I use this :
   for (var n in  block.warningTextDb_) {
          clearTimeout( block.warningTextDb_[n]);
        }
        if( block.warning){
           block.warning.dispose();
          block.warning = null;
        }
        block.warningTextDb_ = null;
    
// remove empty space
         block.render();
         block.bumpNeighbours();

It works great, but every now and then I get rendering errors:
Capture.PNG

It's comming from this.updateConnectionLocations_(); in function render in block_svg.js . Why ? And how do you avoid that?

Beka Westberg

unread,
Nov 2, 2021, 1:37:53 PM11/2/21
to blo...@googlegroups.com
Hello,

My first instinct is that dispose(0 might not be properly cleaning up all of the state. Have you tried using setWarningText(null) to delete it instead of deleting it directly?

Best Wishes =)
Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/d57a111b-dfc4-45f0-a3b8-c90dd287777dn%40googlegroups.com.

pigeonmaléfique

unread,
Nov 2, 2021, 4:17:34 PM11/2/21
to Blockly
Solved:  setWarningText(null) fix display error thanks
Reply all
Reply to author
Forward
0 new messages