Difference between revisions of "GSoC2009 Node Tool Rewrite"

From Inkscape Wiki
Jump to navigation Jump to search
(→‎Extras: add clippath / mask editing)
Line 45: Line 45:
 
|{{yes}}
 
|{{yes}}
 
|{{yes}}
 
|{{yes}}
 +
|-
 +
|Shape editors
 +
|Selecting objects that are not paths shows their manipulators. This is unlikely to get fixed during GSoC, as doing this properly requires at least partially rewriting the shape tools
 +
|{{yes}}
 +
|{{no}}
 
|-
 
|-
 
|Selecting single nodes
 
|Selecting single nodes

Revision as of 21:11, 2 August 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 can be added and removed from a ManipulatorGroup, which takes care of routing events to them.

A subclass of ControlPoint, SelectableControlPoint, can belong to a ControlPointSelection.

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 using the move() method.

Order of emission of drag signals:

  • signal_grabbed
  • signal_dragged
  • signal_dragged
  • signal_dragged
  • ...
  • signal_dragged
  • signal_ungrabbed

Examples of implementation

  • 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

Selection

Feature Description Old tool New tool
Object selection Selecting objects to node-edit (incl. Shift-click, Alt-click); ignores groups Yes Yes
Shape editors Selecting objects that are not paths shows their manipulators. This is unlikely to get fixed during GSoC, as doing this properly requires at least partially rewriting the shape tools Yes No
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. Also works with Shift Yes Yes
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 Yes
Deselect Esc or click outside of selected paths to deselect Yes Yes
Multi-path selection Selecting nodes in two or more different paths; all per-node actions work on all selected nodes No Yes
Rubberband selector Selecting nodes by dragging anywhere to draw a selection rectangle Yes 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
Grow selection Scrolling the mouse wheel when a selected node is hovered over causes the selection to propagate from this node to adjacent nodes in the path (without Ctrl) or to geometrically closest nodes (with Ctrl) Yes No
Preserve selection on undo An attempt is made to preserve the node selection when undoing / redoing Yes No
Transform handles Whether transform handles can be toggled for sets of nodes (needs sensible behavior when one node is selected). Should have 3 settings: never show handles, show for 2+ nodes (default), always show No always on

Node transforms

Feature Description Old tool New tool
Move Moving selections of nodes Yes Yes
Move with keyboard arrows, Shift+arrows, Alt+arrows, Shift+Alt+arrows Yes Yes
Scale with mouse Scaling node sets with the mouse No Yes
Scale with keyboard Scaling nodes with >, <; Alt scales by one pixel Yes Yes
Scale handles with keyboard When only one node is selected, > and < scale its handles Yes partial
Rotate with mouse Rotating node sets with the mouse No Yes
Rotate with keyboard Rotate nodes with [, ]; Alt rotates by one pixel Yes Yes
Rotate handles with keyboard When only one node is selected, [, ] rotate its handles Yes partial
Skew with mouse Skewing node sets with the mouse No Yes
Skew with keyboard Tentative keybinding: / and \ to skew horizontally (corners move by nudgedistance), Ctrl skews vertically, Shift = x10, Alt = one pixel No No
Flip nodes v for vertical flip, h for horizontal, mouseovered node is the center Yes Yes
Constrained dragging Ctrl to restrict movement to axes Yes No
Sculpting Alt to move selected nodes depending on their distance from the cursor and tablet pen pressure Yes No
Affect handles Ability to specify whether handles should be transformed (toggle button) No No

Node types

Feature Description Old tool New tool
Read node types Read and store node type information Yes Yes
Basic (cusp, smooth, symmetric) The second handle is modified according to the node type Yes Yes
Auto nodes Yes Yes
Smooth nodes at ends of linear segments When a smooth node appears on the end of a linear segment, its handle should remain colinear with the segment when the node or the handle are dragged Yes Yes
Set node type Node type can be set and the handles are updated Yes Yes

Node actions

Feature Description Old tool New tool
Add node with mouse Double-click on a path segment to add node Yes Yes
Insert nodes Insert a node in the middle of each selected segment (Insert, Shift+I, toolbar) Yes Yes
Delete nodes Del to remove nodes while trying to preserve shape; hold Control to leave adjacent handles alone Yes Yes
Join nodes Join two end nodes into one Yes Yes
Weld nodes Joining non-end nodes welds them into one with averaged position No Yes
Mouseover join If a node is mouseovered when joining nodes, its position is used as the position for the joined node Yes does not work with welding
Multi-path node join Joining nodes in different paths works sensibly No Yes
Break nodes Break subpaths into pieces at the selected nodes Yes Yes
Align nodes Alignment actions in Align and Distribute dialog Yes No
Snap nodes Nodes snap according to snap settings when transformed Yes No
Copy / paste subpaths Ability to add a subpath by pasting it into the selected path No No

Segment actions

Feature Description Old tool New tool
Curve drag Dragging a segment changes its appearance Yes Yes
Join segment Connect two end nodes with a segment Yes Yes
Weld segments Joining segments when non-end nodes are selected replaces each contiguous segment selection with one segment No No
Multi-path segment join Join between subpaths in different paths No Yes
Delete segment Remove a path segment between two nodes Yes Yes
Improved segment deletion Arbitrary number of segments can be deleted at once; selected segments at the start and end of subpath are trimmed No Yes

Display

Feature Description Old tool New tool
Unselected path outline Outline promptly flashes when hovering over a unselected path Yes No
Selected path outline Outline of the selected path is drawn when the "show outline" toggle button is on Yes always on
Curve drag cursor The cursor changes when hovering over a curve to indicate that it will be dragged Yes Yes
Smooth redraws Dragging doesn't cause excessive tearing or other artifacts Yes Yes
Statusbar information Display the number of selected nodes and useful tips in the statusbar Yes No
Path direction Small arrows on the outline optionally visualize the direction of the path No always on, does not update on zooming

Handles

Feature Description Old tool New tool
Handle display Handles are displayed on the selected nodes and their neighbors Yes Yes
Flip handles v for vertical flip, h for horizontal Yes Yes
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
Retract handles by dragging Drag a handle near its node to hide it; Retracting both handles of a Bezier segment makes it a line No Yes
Retract handles with click Ctrl+click retracts a handle 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

Extras

Feature Description Old tool New tool
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 Yes
Multi mask edit Can edit the clipping and masking paths of several items at once No Yes
Grouped masks Can handle groups used as clipping paths or masks No Yes
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