Size: 188
Comment:
|
← Revision 9 as of 2008-08-16 18:20:10 ⇥
Size: 2274
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
The tools often function within a group of tools. They share a common way of using mouse buttons, and it is oke to push a tool unto the stack, and returning to the parent tool after stopping itself. Like tools based on <<Dox(a2dStTool)>> use all as controller <<Dox(a2dStToolContr)>>. | |
Line 5: | Line 6: |
= Tool state = | = Changing State = A tool is used to manipulate what is in a drawing. User input combined with selected objects and mouse hit objects, brings a tool from one state into another. Down here some examples of what can bring a tool into a different state. ||<rowstyle="background-color: #FFFFE0;"> mouse event ||key state || object hit ||object selected|| action || ||LeftDown || || true || 1 || Select object hit || ||RightDown || || true || 1 || depends on drag or not || ||LeftDown ||Ctrl Down || true || 1 || deselect all & add hit object || ||LeftDown + drag ||Ctrl Down || true || 0 || deselect all & add selected objects || ||LeftDown + drag ||Shift Down || true || 0 || add selected objects in rect || ||LeftDown + drag ||Alt Down || true || n >= 1 || move selected objects || ||RightDown + drag ||Ctrl Down || true || 1 || drag canvas area || ||LeftDown + LeftUp at xy ||Alt Down || true || 1 || select || ||RightDown + RightUp at xy ||Alt Down || true || 0 || popup menu || ||LeftUp || || true || 1 || depending on keys, treat dragged rect || || non || Space bar || false || 0 || zoom out || = Tool push and pop = A tool controller, is designed to be able to push and pop tools from a tool stack. This makes it possible to draw a polygon, and while doing push a zooming tool onto the stack, continue drawing, and zoom out again. And that way it easy to draw a polygon very accurate even it is all over the drawing. |
Line 8: | Line 29: |
= Zoom Tool = {{attachment:Diagram1.png}} |
How to make new tools
The best is to derive from existing tools, and redefine only what you don't like. The tools often function within a group of tools. They share a common way of using mouse buttons, and it is oke to push a tool unto the stack, and returning to the parent tool after stopping itself. Like tools based on a2dStTool use all as controller a2dStToolContr.
Changing State
A tool is used to manipulate what is in a drawing. User input combined with selected objects and mouse hit objects, brings a tool from one state into another. Down here some examples of what can bring a tool into a different state.
mouse event |
key state |
object hit |
object selected |
action |
|
true |
1 |
Select object hit |
|
|
true |
1 |
depends on drag or not |
|
Ctrl Down |
true |
1 |
deselect all & add hit object |
|
LeftDown + drag |
Ctrl Down |
true |
0 |
deselect all & add selected objects |
LeftDown + drag |
Shift Down |
true |
0 |
add selected objects in rect |
LeftDown + drag |
Alt Down |
true |
n >= 1 |
move selected objects |
RightDown + drag |
Ctrl Down |
true |
1 |
drag canvas area |
Alt Down |
true |
1 |
select |
|
Alt Down |
true |
0 |
popup menu |
|
|
true |
1 |
depending on keys, treat dragged rect |
|
non |
Space bar |
false |
0 |
zoom out |
Tool push and pop
A tool controller, is designed to be able to push and pop tools from a tool stack. This makes it possible to draw a polygon, and while doing push a zooming tool onto the stack, continue drawing, and zoom out again. And that way it easy to draw a polygon very accurate even it is all over the drawing.
Zoom Tool