Comment #2 on issue 790 by google....(a)ben.coman.com.au: adding Mondrian
subview interactively operates on wrong node
http://code.google.com/p/moose-technology/issues/detail?id=790
This is a bit presumptuous without knowing Mondrian better architecturally,
but I can't help thinking that some of the methods named 'forNode' would be
more appropriately named 'forNodeValue' - particularly for interaction such
as
registerForEvent:forNode:updateNode:updateLayout:. Having tried tracing
this down further, the root cause is that the "node that is clicked" is not
operated on directly. Instead the "value" of the clicked node searched
from root. Where the same value occurs multiple times in a graph, a
different node might be found for "that value" to apply the operation to
rather than the "node that was clicked".
Instead I expect to be able to apply operations to the actual node that I
selected.
Here is another example...
----8<-----
view nodes: (1 to: 5) forEach:
[:each |
view interaction strongHighlightWhenOver: [ :v | v ].
view shape rectangle withText; size: 20.
view nodes: (1 to: each).
view gridLayout
].
----8<-----
Executing this in Mondrian Easel (taking for example the third group) small
squares 1 & 2 do not highlight when hovering over them, and hovering over
small square 3 highlights the large square rather than its small square.
I can get what I consider the usually expected behaviour by modifying
MOAnnouncer>>registerForEvent:forNodes:updateShape:updateLayout:
replacing...
domainNodes := (aBlockOrSymbol moValue: ann element model).
nodes := ann viewRenderer nodeForDomainValues: domainNodes.
by...
nodes := OrderedCollection new add: ann element ; yourself.
I can see where you might want all graph nodes having the same value to
highlight when any one is selected, for which a method
registerForEvent:forNodeValues: might be appropriate.
It is however not clear to me whether the 'node' in the forNodes is
referring to a node in the model or a node in the display. I am presuming
the latter - particularly in relation to interactions.