Difference between revisions of "GSoC2009 Node Tool Rewrite"

From Inkscape Wiki
Jump to navigation Jump to search
Line 46: Line 46:
|Object selection
|Object selection
|Selecting objects to node-edit (incl. Shift-click, Alt-click); ignores groups
|Selecting objects to node-edit (incl. Shift-click, Alt-click); ignores groups
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
|Selecting single nodes
|Selecting single nodes
|Whether selecting single nodes with left-click works correctly.
|Whether selecting single nodes with left-click works correctly.
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 55: Line 57:
|Click on a path segment to select adjacent nodes
|Click on a path segment to select adjacent nodes
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Selecting multiple nodes
|Selecting multiple nodes
|Shift-click to toggle selection of a node
|Shift-click to toggle selection of a node
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 63: Line 67:
|Ctrl+A selects all nodes in subpaths that have something selected, Ctrl+Alt+A selects all nodes
|Ctrl+A selects all nodes in subpaths that have something selected, Ctrl+Alt+A selects all nodes
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Deselect
|Deselect
|Esc or click outside of selected paths to deselect
|Esc or click outside of selected paths to deselect
|{{yes}}
|{{yes}}
|?
|-
|-
|Multi-path selection
|Multi-path selection
|Selecting nodes in two or more different paths
|Selecting nodes in two or more different paths
|{{no}}
|{{no}}
|{{yes}}
|-
|-
|Prev/Next node
|Prev/Next node
|Tab to select next node, Shift+Tab to select previous
|Tab to select next node, Shift+Tab to select previous
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Invert Selection
|Invert Selection
|! key inverts node selection in selected subpaths, Alt+! in the whole path
|! key inverts node selection in selected subpaths, Alt+! in the whole path
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Nodeset selection cue
|Nodeset selection cue
|Whether a selection cue with transform handles can be toggled for sets of nodes (needs sensible behavior when one node is selected)
|Whether a selection cue with transform handles can be toggled for sets of nodes (needs sensible behavior when one node is selected)
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 88: Line 98:
|Move
|Move
|Moving selections of nodes
|Moving selections of nodes
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 93: Line 104:
|arrows, Shift+arrows, Alt+arrows, Shift+Alt+arrows
|arrows, Shift+arrows, Alt+arrows, Shift+Alt+arrows
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Scale with mouse
|Scale with mouse
|Scaling node sets with the mouse (needs selection cue)
|Scaling node sets with the mouse (needs selection cue)
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 101: Line 114:
|Both Ctrl and Alt keys + >, <
|Both Ctrl and Alt keys + >, <
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Rotate with mouse
|Rotate with mouse
|Rotating node sets with the mouse
|Rotating node sets with the mouse
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 109: Line 124:
|Both Ctrl and Alt keys and <nowiki>[, ]</nowiki>
|Both Ctrl and Alt keys and <nowiki>[, ]</nowiki>
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Skew with mouse
|Skew with mouse
|Skewing node sets with the mouse
|Skewing node sets with the mouse
|{{no}}
|{{no}}
|{{no}}
|-
|-
|Skew with keyboard
|Skew with keyboard
|
|
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 121: Line 139:
|v for vertical flip, h for horizontal
|v for vertical flip, h for horizontal
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Movement restriction
|Constrained dragging
|Ctrl to restrict movement to axes
|Ctrl to restrict movement to axes
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Sculpting
|Sculpting
|Alt to move selected nodes depending on their distance from the cursor
|Alt to move selected nodes depending on their distance from the cursor
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Affect handles
|Affect handles
|Ability to specify whether handles should be transformed (toggle button)
|Ability to specify whether handles should be transformed (toggle button)
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 139: Line 161:
|Double-click on path segment to add node
|Double-click on path segment to add node
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Delete nodes
|Delete nodes
|Del to remove nodes while trying to preserve shape
|Del to remove nodes while trying to preserve shape
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Join nodes
|Join nodes
|Fuse two nodes into one
|Fuse two nodes into one
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Multi-path node join
|Multi-path node join
|Joining nodes in different paths works sensibly
|Joining nodes in different paths works sensibly
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 155: Line 181:
|Joining two nodes with a segment works correctly
|Joining two nodes with a segment works correctly
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Multi-path segment join
|Multi-path segment join
|Join between subpaths in different paths works
|Join between subpaths in different paths works
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 163: Line 191:
|Removing a path segment between two nodes
|Removing a path segment between two nodes
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Align nodes
|Align nodes
|Alignment actions in Align and Distribute dialog
|Alignment actions in Align and Distribute dialog
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Snap nodes
|Snap nodes
|Nodes snap according to snap settings when transformed
|Nodes snap according to snap settings when transformed
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
!colspan="4" style="font-size:150%"|Display
!colspan="4" style="font-size:150%"|Display
Line 177: Line 208:
|Outline promptly flashes when hovering over a unselected path
|Outline promptly flashes when hovering over a unselected path
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Selected path outline
|Selected path outline
|Outline of the selected path is drawn
|Outline of the selected path is drawn
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 187: Line 220:
|Handles are displayed on the selected nodes and their neighbors
|Handles are displayed on the selected nodes and their neighbors
|{{yes}}
|{{yes}}
|partial (all handles visible)
|-
|-
|Flip handles
|Flip handles
|v for vertical flip, h for horizontal
|v for vertical flip, h for horizontal
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Lock handle length
|Lock handle length
|Alt to move handles while preserving length
|Alt to move handles while preserving length
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Move along handles
|Move along handles
|Ctrl+Alt to restrict node movement to the handle lines
|Ctrl+Alt to restrict node movement to the handle lines
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Drag out handles
|Drag out handles
|Shift + mouse drag to drag out a handle that coincides with a node
|Shift + mouse drag to drag out a handle that coincides with a node
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 207: Line 245:
|Ctrl to restrict handle movements to ~15 degree angle increments from axis-aligned and the original angle
|Ctrl to restrict handle movements to ~15 degree angle increments from axis-aligned and the original angle
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Snap handles
|Snap handles
|Handles can be snapped to other snap targets
|Handles can be snapped to other snap targets
|{{no}}
|{{no}}
|{{no}}
|-
|-
|Copy / paste handles
|Copy / paste handles
|Ability to copy and paste handles between nodes
|Ability to copy and paste handles between nodes
|{{no}}
|{{no}}
|{{no}}
|-
|-
|Copy / paste subpaths
|Copy / paste subpaths
|Ability to add a subpath by pasting it into the selected path
|Ability to add a subpath by pasting it into the selected path
|{{no}}
|{{no}}
|{{no}}
|-
|-
Line 224: Line 266:
|Drag tolerance
|Drag tolerance
|Drags shorter than a configurable distance are regarded as clicks
|Drags shorter than a configurable distance are regarded as clicks
|{{yes}}
|{{yes}}
|{{yes}}
|-
|-
Line 229: Line 272:
|Buttons to edit the clipping and masking paths in place
|Buttons to edit the clipping and masking paths in place
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Path effect param editing
|Path effect param editing
|Button to to edit the next path parameter of the selected live path effect
|Button to to edit the next path parameter of the selected live path effect
|{{yes}}
|{{yes}}
|{{no}}
|-
|-
|Prefs page
|Prefs page
|Node tool preferences page with various settings
|Node tool preferences page with various settings
|{{yes}}
|{{yes}}
|{{no}}
|}
|}


[http://inkscape.org/doc/keys046.html#id2248621 Inkscape key guide for the node tool] - more detailed description of the old node tool's features
[http://inkscape.org/doc/keys046.html#id2248621 Inkscape key guide for the node tool] - more detailed description of the old node tool's features

Revision as of 17:35, 27 June 2009

This page tracks the progress of the node tool rewrite project which is a part of the Google Summer of Code 2009. This project is being implemented by Krzysztof Kosiński, and the mentor is Bulia Byak. This page will be kept updated with the current status of the student's code (it may not reflect the code in the trunk).

Implementation details

(Work in progress)

Control points (Knots) will be represented by a new class called ControlPoint, based on SPKnot, but with a slightly different set of signals. A set of control points will be managed in a Manipulator. Manipulators will be sets of control points that have queriable selection status. Manipulators will be managed in a top level ItemEditor object, which will be the main object used by the new node context (this object cannot be called ShapeEditor for now, because they have to exist side by side).

ControlPoint signals

  • signal_dragged - emitted when the point is dragged to a new position
  • signal_grabbed - start of drag. Emitted when there was a click and a move larger than drag tolerance.
  • signal_ungrabbed - end of drag
  • signal_moved - knot was moved to new position. Emitted in response to the move() method or finished drag.

Order of emission:

  • signal_clicked
  • signal_grabbed
  • signal_dragged
  • signal_dragged
  • signal_dragged
  • ...
  • signal_dragged
  • signal_ungrabbed
  • signal_moved

Examples of implementation

  • Moving selection: the manipulator connects to signal_dragged and signal_ungrabbed. It updates the position of its other selected control points in response to signal_dragged, which it keeps in a list (selectable control points have signal_selected and signal_deselected which are connected to from the manipulator to update the list of selected control points accordingly) and updates the XML in response to signal_ungrabbed.
  • Dragging out handles: the manipulator connects to signal_clicked, and intercepts it if Shift is held. It then creates a new ControlPoint for the dragged out handle and connects to signal_moved, which is only emitted when the drag is finished. in response to signal_moved, the distance between the node and the handle is checked against the drag tolerance; if it's smaller, the handle is deleted and the path is not updated. If it's larger, repr is updated.
  • Constrained dragging: the manipulator connects to signal_dragged. In response to it, it calculates the constrained position, calls setPosition (which doesn't emit any signals) and returns true, which prevents the position from being updated. The events still flow only to the control point due to a pointer grab.
  • Handle dragging: A control point representing a node will be subclassed, and will know about its handles. Handles will also be subclassed and know about their nodes. There will be an additional handler for signal_dragged, which will update the position of the other handle appropriately.

Feature Checklist

Feature Description Old tool New tool
Selection
Object selection Selecting objects to node-edit (incl. Shift-click, Alt-click); ignores groups Yes Yes
Selecting single nodes Whether selecting single nodes with left-click works correctly. Yes Yes
Select segment Click on a path segment to select adjacent nodes Yes No
Selecting multiple nodes Shift-click to toggle selection of a node Yes Yes
Select all Ctrl+A selects all nodes in subpaths that have something selected, Ctrl+Alt+A selects all nodes Yes No
Deselect Esc or click outside of selected paths to deselect Yes ?
Multi-path selection Selecting nodes in two or more different paths No Yes
Prev/Next node Tab to select next node, Shift+Tab to select previous Yes No
Invert Selection ! key inverts node selection in selected subpaths, Alt+! in the whole path Yes No
Nodeset selection cue Whether a selection cue with transform handles can be toggled for sets of nodes (needs sensible behavior when one node is selected) No No
Transforms
Move Moving selections of nodes Yes Yes
Move with keyboard arrows, Shift+arrows, Alt+arrows, Shift+Alt+arrows Yes No
Scale with mouse Scaling node sets with the mouse (needs selection cue) No No
Scale with keyboard Both Ctrl and Alt keys + >, < Yes No
Rotate with mouse Rotating node sets with the mouse No No
Rotate with keyboard Both Ctrl and Alt keys and [, ] Yes No
Skew with mouse Skewing node sets with the mouse No No
Skew with keyboard No No
Flip nodes v for vertical flip, h for horizontal Yes No
Constrained dragging Ctrl to restrict movement to axes Yes No
Sculpting Alt to move selected nodes depending on their distance from the cursor Yes No
Affect handles Ability to specify whether handles should be transformed (toggle button) No No
Node actions
Add nodes Double-click on path segment to add node Yes No
Delete nodes Del to remove nodes while trying to preserve shape Yes No
Join nodes Fuse two nodes into one Yes No
Multi-path node join Joining nodes in different paths works sensibly No No
Join segment Joining two nodes with a segment works correctly Yes No
Multi-path segment join Join between subpaths in different paths works No No
Delete segment Removing a path segment between two nodes Yes No
Align nodes Alignment actions in Align and Distribute dialog Yes No
Snap nodes Nodes snap according to snap settings when transformed Yes No
Display
Unselected path outline Outline promptly flashes when hovering over a unselected path Yes No
Selected path outline Outline of the selected path is drawn Yes Yes
Handles
Handle display Handles are displayed on the selected nodes and their neighbors Yes partial (all handles visible)
Flip handles v for vertical flip, h for horizontal Yes No
Lock handle length Alt to move handles while preserving length Yes No
Move along handles Ctrl+Alt to restrict node movement to the handle lines Yes No
Drag out handles Shift + mouse drag to drag out a handle that coincides with a node Yes Yes
Restrict movement Ctrl to restrict handle movements to ~15 degree angle increments from axis-aligned and the original angle Yes No
Snap handles Handles can be snapped to other snap targets No No
Copy / paste handles Ability to copy and paste handles between nodes No No
Copy / paste subpaths Ability to add a subpath by pasting it into the selected path No No
Extras
Drag tolerance Drags shorter than a configurable distance are regarded as clicks Yes Yes
Clip / mask editing Buttons to edit the clipping and masking paths in place Yes No
Path effect param editing Button to to edit the next path parameter of the selected live path effect Yes No
Prefs page Node tool preferences page with various settings Yes No

Inkscape key guide for the node tool - more detailed description of the old node tool's features