Dear List,
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. You can find them in the version 384.
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.
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.