gNode(coord,obj) is a shortcut for obj ++ { TransformMatrix => translation coord }, where obj is some GraphicsObject and coord the coordinates of the new reference origin. gNode(coord,a,b,c) is a shortcut for gList(a,b,c) ++ { TransformMatrix => translation coord }.
i1 : a=gNode([-1,-1],Circle{Radius=>0.1,"fill"=>"red","stroke"=>"black"}) o1 = a o1 : Circle |
i2 : b=gNode([1,1],Circle{Radius=>0.1,"fill"=>"green","stroke"=>"black",Draggable=>true}) o2 = b o2 : Circle |
i3 : gList(Line{a,b},a,b) o3 = GraphicsList{cache => CacheTable{} } Contents => {Line{cache => CacheTable{} }, a, b} Point1 => GraphicsCoordinate{JsFunc => -*Function[/usr/share/Macaulay2/VectorGraphics.m2:70:29-70:61]*- } RefPointFunc => -*Function[/usr/share/Macaulay2/VectorGraphics.m2:69:37-69:62]*- Point2 => GraphicsCoordinate{JsFunc => -*Function[/usr/share/Macaulay2/VectorGraphics.m2:70:29-70:61]*- } RefPointFunc => -*Function[/usr/share/Macaulay2/VectorGraphics.m2:69:37-69:62]*- style => MutableHashTable{} style => MutableHashTable{} o3 : GraphicsList |
Dragging acts recursively:
i4 : l=null; scan(5,i->l=gNode([100,0],l,Circle{"fill"=>"red"},Draggable=>true)); l++{Margin=>1} o6 = GraphicsList{cache => CacheTable{} } Contents => {GraphicsList{cache => CacheTable{} }, Circle{cache => CacheTable{} }} Contents => {GraphicsList{cache => CacheTable{} }, Circle{cache => CacheTable{} }} Center => | 0 | Contents => {GraphicsList{cache => CacheTable{} }, Circle{cache => CacheTable{} }} Center => | 0 | | 0 | Contents => {Circle{cache => CacheTable{} }, Circle{cache => CacheTable{} }} Center => | 0 | | 0 | | 0 | Center => | 0 | Center => | 0 | | 0 | | 0 | | 1 | | 0 | | 0 | | 0 | | 1 | Radius => 50 | 0 | | 0 | | 1 | Radius => 50 style => MutableHashTable{...1...} | 1 | | 1 | Radius => 50 style => MutableHashTable{...1...} Draggable => true Radius => 50 style => MutableHashTable{...1...} Radius => 50 style => MutableHashTable{...1...} style => MutableHashTable{...1...} TransformMatrix => | 1 0 0 100 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | Draggable => true style => MutableHashTable{} TransformMatrix => | 1 0 0 100 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | Draggable => true style => MutableHashTable{} TransformMatrix => | 1 0 0 100 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | Draggable => true style => MutableHashTable{} TransformMatrix => | 1 0 0 100 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | Draggable => true Margin => 1 style => MutableHashTable{} TransformMatrix => | 1 0 0 100 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | o6 : GraphicsList |
The object gNode is a function closure.