NorthwoodsSoftware / GoJS

JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.
http://gojs.net
Other
7.7k stars 2.86k forks source link

Animation while editing a TextBlock cause weird behavior #166

Closed ba2sik closed 2 years ago

ba2sik commented 2 years ago

Hello, I came across a strange behavior that happens when you edit a text in a TextBlock, and at the same time animate the diagram/node. The text editing window stays in the previous place, and it looks very strange ...

A reproducible link: https://codepen.io/ba2sik/pen/MWEVrYb Simply click twice on the node to edit the text, and watch editing winow.

simonsarris commented 2 years ago

What browser are you using? Can you screenshot what you are seeing?

In Chrome it seems to work OK. The text input stays in the same location while the node moves around, but otherwise I see not change.

Generally I would not recommend moving a node when a user is trying to edit it, but that's not something we would want to enforce at the library level.

ba2sik commented 2 years ago

I'm using Google Chrome version 96. This is what I see: image

IDK if this is the intended behavior, but it looks kinda weird to me😅

simonsarris commented 2 years ago

I see that too, after editing has begun and after the node has moved. But I think moving the editor with the node would be a mistake to implement. Instead I suggest that any action you create that might move a node will also cease when the TextEditingTool starts. This is difficult to predict from a library standpoint, it is up to individual authors.

ba2sik commented 2 years ago

In my case, when I select a node, I want the diagram to be centered to the specific node using scrollToPart. In addition, I implemented an edit button on a node, that when you click on it, starts editing the text. The problem is that if the node is not already selected, clicking the edit button also selects the node, which causes the node to be centered with animation, and it leaves the editor in the previous place of the node (before the animation started).

Do you have any suggestions as to what I should do? Thank you!

WalterNorthwoods commented 2 years ago

Either:

simonsarris commented 2 years ago

For any non-bug questions, please continue via the forum.

WalterNorthwoods commented 2 years ago

For v2.2, upon activation the TextEditingTool now stops any default animation. Thanks for the implicit suggestion.

ba2sik commented 2 years ago

Thank you very much! Fixing it by moving the text editor along with the node won't be a better solution?

WalterNorthwoods commented 2 years ago

That would be very disconcerting to most users.