Macaulay2 » Documentation
Packages » VectorGraphics :: Draggable
next | previous | forward | backward | up | index | toc

Draggable -- An option to make a GraphicsObject draggable

Description

If this option is turned on, the GraphicsObject can be dragged with the mouse (left button for translation, right button for rotation). It this object is reused as coordinate for other objects, they will be updated accordingly. Compare the following two examples:

i1 : circ = Circle{Radius=>0.1,"fill"=>"red"}; a = gNode([-1,0],circ,Draggable=>true); b = gNode([1,0.5],circ,Draggable=>true);  c = gNode([1,-0.5],circ,Draggable=>true);
i5 : gList(Polygon{{[-1,0],[1,0.5],[1,-0.5]}},a,b,c)

o5 = GraphicsList{cache => CacheTable{}                                                                                                          }
                  Contents => {Polygon{cache => CacheTable{}                                                                          }, a, b, c}
                                       PointList => {GraphicsCoordinate | -1 |, GraphicsCoordinate |  1 |, GraphicsCoordinate |  1  |}
                                                                        |  0 |                     | .5 |                     | -.5 |
                                                                        |  0 |                     |  0 |                     |  0  |
                                                                        |  1 |                     |  1 |                     |  1  |
                                       style => MutableHashTable{}
                  style => MutableHashTable{}

o5 : GraphicsList
i6 : gList(Polygon{{a,b,c}},a,b,c)

o6 = GraphicsList{cache => CacheTable{}                                                                                          }
                  Contents => {Polygon{cache => CacheTable{}                                                          }, a, b, c}
                                       PointList => {GraphicsCoordinate a, GraphicsCoordinate b, GraphicsCoordinate c}
                                       style => MutableHashTable{}
                  style => MutableHashTable{}

o6 : GraphicsList

Dragging acts recursively:

i7 : l=null; scan(5,i->l=gNode([100,0],l,Circle{"fill"=>"red"},Draggable=>true)); l++{Margin=>1}

o9 = GraphicsList{cache => CacheTable{}                                                                                                                                                                                                                                                                                                       }
                  Contents => {GraphicsList{cache => CacheTable{}                                                                                                                                                                                                                               }, Circle{cache => CacheTable{}             }}
                                            Contents => {GraphicsList{cache => CacheTable{}                                                                                                                                                       }, Circle{cache => CacheTable{}             }}          Center => GraphicsCoordinate | 0 |
                                                                      Contents => {GraphicsList{cache => CacheTable{}                                                                               }, Circle{cache => CacheTable{}             }}          Center => GraphicsCoordinate | 0 |                                         | 0 |
                                                                                                Contents => {Circle{cache => CacheTable{}             }, Circle{cache => CacheTable{}             }}          Center => GraphicsCoordinate | 0 |                                         | 0 |                                         | 0 |
                                                                                                                    Center => GraphicsCoordinate | 0 |          Center => GraphicsCoordinate | 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   |

o9 : GraphicsList

For the programmer

The object Draggable is a symbol.