connection highlight

112 views
Skip to first unread message

Koen Van Wijk

unread,
Sep 6, 2022, 5:50:23 PM9/6/22
to Blockly
Hello,

I made an attempt to show diffs between Blockly workspaces. Something like the attached figure. 

Therefore I like to highlight changed connections. I use the RenderedConnection highlight function: https://developers.google.com/blockly/reference/js/Blockly.RenderedConnection#highlight

I also like to be able to unhighlight. So I use the unhighlight as well. However the unhighlight does not work as it is meant for highlighting only one connection as it stores the information in the class. 
Connection.highlightedPath_ = dom.createSvgElement(....);

Do I have any options to have multiple highlighted connections and still be able to unhighlight them? An ideas on where to store the newly created dom?

Regards,
Koen van Wijk



blockly-diff.png

Christopher Allen

unread,
Sep 9, 2022, 3:21:03 PM9/9/22
to blo...@googlegroups.com
Hello Koen,

I also like to be able to unhighlight. So I use the unhighlight as well. However the unhighlight does not work as it is meant for highlighting only one connection as it stores the information in the class. 
Connection.highlightedPath_ = dom.createSvgElement(....);

Wow, now that is a crufty bit of code—and it dates back a long way, at least prior to Connection and RenderedConnection being split into separate classes.

Since the implementation does not match the description, I have taken the liberty of fixing that; the fix should be included in the next release at the end of this month.

In the meantime, you could kludge around the bug by copying the value of Blockly.Connection.highlightedPath_ onto the RenderedConnection object after calling .highlight, and then copy it back before calling .unhilight.  Just make sure not to forget to remove such an atrocity before updating to Blockly v9.x!


Thanks for the detailed and clear bug report; it made it very easy to fix.


Christopher

Koen Van Wijk

unread,
Sep 11, 2022, 5:13:44 PM9/11/22
to Blockly
Thks for the quick fix... It was quiet for 2 days on the topic, so I thought no one understood my message... however you were already working on a solution :-)

Koen Van Wijk

unread,
Sep 12, 2022, 6:52:50 PM9/12/22
to Blockly
What should be the behaviour if I call the highlight function twice?


On Friday, September 9, 2022 at 9:21:03 PM UTC+2 cpca...@google.com wrote:

Christopher Allen

unread,
Sep 12, 2022, 7:05:37 PM9/12/22
to blo...@googlegroups.com
Hi Koen,
 
What should be the behaviour if I call the highlight function twice?

If you call the highlight method on two different connections they should both get highlighted.  That should work even in the current version of Blockly—only unhighlighting was broken, as far as I know.


Christopher

Koen van Wijk

unread,
Sep 13, 2022, 11:59:38 AM9/13/22
to blo...@googlegroups.com

Yes indeed that works. What if I call highlight twice on the same connection?

 

Sent from Mail for Windows

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/lYbTqXR2yq4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/CAN0w5eYJo9jr8uek7bVg%3D%2B-i%3DG_Y2krxM7K-4%2BozGReKBMcqTw%40mail.gmail.com.

 



-------- Disclaimer --------
This email and any files transmitted may contain proprietary and confidential information of ICT Group or any of its subsidiaries (“ICT”) and is intended only for the (use of the) named recipient(s) above. If you have received this message in error or are not the intended or named recipient(s) of this message, please immediately notify the sender by return and delete this email message from your computer. Any views or opinions presented are solely those of its author and do not necessarily represent those of ICT. You are hereby notified that unauthorized disclosure, use, dissemination, forwarding, printing or copying of this e-mail and its attachments either whole or partial of its contents is strictly prohibited. ICT cannot guarantee that email communications are secured and error-free and does not accept any liability for damages resulting from the use of email. The general terms and conditions of purchase respectively sale and delivery of ICT are applicable to all transactions and undertakings resulting therefrom.


Koen Van Wijk

unread,
Oct 5, 2022, 11:14:33 AM10/5/22
to Blockly
Did this fix 6416 make it into Blockly 9? I can not find in the release notes. 

Maribeth Bottorff

unread,
Oct 5, 2022, 2:28:37 PM10/5/22
to Blockly
Yes, it should be included.

I'm not sure why it wasn't included in the notes... we use an automated tool to generate the notes so that's a bit disconcerting that it didn't catch all of them. I've manually added this PR to the notes on GitHub. Thanks for flagging this!

Maribeth

Koen Van Wijk

unread,
Oct 6, 2022, 6:06:04 PM10/6/22
to Blockly
I check the new implementation, however it is possible to call high_light twice and unhigh_light twice but then still some yellow line is kept as only one reference is kept. Should the high_light not protect itself against a second high_light call? 
One highlight seem enough. Of course it is possible to check the state in the client... what do you think?

Koen Van Wijk

unread,
Oct 6, 2022, 6:15:05 PM10/6/22
to Blockly
also the drag highlighter does not check if the connection is already highlighed so checking the state in my editor is not sufficient. 

Maribeth Bottorff

unread,
Oct 6, 2022, 7:33:24 PM10/6/22
to Blockly
Yeah, this is still a problem. We'd accept a PR if you'd like to fix it. I've filed an issue for this here: https://github.com/google/blockly/issues/6501

Maribeth

Reply all
Reply to author
Forward
0 new messages