Hi Alex,
Yesterday evening I found the time between two ground
shakes to have
a chat with Doru about porting some of the Glamour ideas in Mondrian.
I would like to have a better support for interaction, useful for
animation.
In Glamour, the essential idea for interaction rely on 4 notions:
Pane, Presentation, Port and Transmission. (Please, correct me if I
am wrong).
The Mondrian equivalent of Pane and Presentation are MOGraphElement
and MOShape, respectively. Port and Transmission are left to be
implemented.
Yes.
You can find them in the version 384.
Well, kind of :) in the sense that Ports do not belong to the
GraphElement which should be the case.
Here is a short test I wrote (all the test methods
given here may be
found in MOInteractionTest).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
testSimpleTransmission
| node1 node2 transmission |
node1 := MONode on: 'test1'.
node2 := MONode on: 'test2'.
transmission := (MOTransmission new)
origin: (node1 interaction port: #output);
destination: (node2 interaction port: #input);
yourself.
(node1 interaction port: #output) value: 42.
self assert: (node1 interaction port: #output) value = 42.
self assert: (node2 interaction port: #input) value = nil.
transmission transmit.
self assert: (node1 interaction port: #output) value = 42.
self assert: (node2 interaction port: #input) value = 42
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Then, I can write:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
testEmittingOnAPort2
| view transmission nodeSet1 nodeSet2 globalVariable node1 node2
interaction1 |
view := MOViewRenderer new.
interaction1 :=
view interaction
on: MOMouseEnter do: [:ann | ann transmit: 42 onPort: #output ];
yourself.
nodeSet1 := view nodes: (1 to: 20).
node1 := nodeSet1 first.
view interaction
from: interaction1 port: #output do: [:ann | globalVariable :=
ann value ].
nodeSet2 := view nodes: (21 to: 40).
node2 := nodeSet2 first.
window := view open.
self assert: (globalVariable isNil).
node1 announce: (MOMouseEnter new).
self assert: (globalVariable = 42).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
But there is something wrong. In the second script, interaction1
should not be necessary, shouldn't it? Else it defeats the whole
purpose of having port and transmission.
Not really. You need two things:
- populate a port
- define a transmission from it to another port
What we did in Glamour was to attach to each Presentation a kind of
default interaction. In your example, I would make #mouseEnter,
#mouseClick ... default ports that are populated when the
corresponding interactions happen on a graph element.
Then of course, these ports will belong to graph elements. Like this
transmissions are created between the ports of a graph element.
Perhaps there will also be a need to identify graph elements by name
so that you can refer to them from outside the context of a script.
Also, in Glamour, a Browser encapsulates everything. So, if you want
to access something from inside, you have to explicitly transmit from
inside to the outside and then use it from there. Like this you do not
have problems with nesting and naming which can be brittle when you
embed an arbitrary number of browsers. I would do the same here.
Cheers,
Doru
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"What we can governs what we wish."