scenic-view icon indicating copy to clipboard operation
scenic-view copied to clipboard

TreeView does not Scroll to mouse-selected element

Open JonathanGiles opened this issue 9 years ago • 1 comments

Original report by Anonymous.


When you use the option "Scenegraph > Component Highlight/select on click" the element you've selected does not gets scrolled to on the treeView and so you end up with the information of the node but still no idea where it is located on the tree.

JonathanGiles avatar Sep 13 '16 15:09 JonathanGiles

Original comment by Developer Diez (Bitbucket: flaviodiez, GitHub: Unknown).


(I forgot to login before I've added the issue)

I found the reason for that and actually did a fix but somehow I cannot create a pull request (maybe I need to be allowed?). Anyway:

On ScenicViewGui.doDispatchEvent() after the case NODE_SELECTED runs its course, we immediately have the event ROOT_UPDATED being called which prompts a kind of refresh of the treeView.

This issue is apparently trying to be handled inside ScenegraphTreeView.updateStageModel():

#!java
if (previouslySelectedItem != null) {
			/**
			 * TODO Why this is not working??
			 */
			// treeView.getSelectionModel().clearSelection();
			// treeView.getSelectionModel().select(previouslySelectedItem);
			/**
			 * TODO Remove
			 */
			setSelectedNode(previouslySelectedItem);
		}

However that does not work correctly... By making the last line to be:

#!java
nodeSelected(previouslySelectedItem.getValue());

instead of:

#!java

setSelectedNode(previouslySelectedItem);

this actually starts to work again.

Just as info: I am running this on Ubuntu 16.04

JonathanGiles avatar Sep 13 '16 16:09 JonathanGiles