path_editor 1.1.0
path_editor: ^1.1.0 copied to clipboard
A Flutter widget for visually editing vector paths, with a configurable Figma style pen tool.
1.1.0 #
Shift+Delete/Backspacecut the path at the selected points.Delete,Backspace,Escape,Enterand numpadEnterfall back to the best matching shortcut when unmapped modifiers are held, so for exampleAlt+Deletenow removes the selection likeDeleteinstead of doing nothing. SeePathEditorShortcuts.withFallbacks.- Breaking: the
cutPathmodifier now only applies to remove-clicks with the pen tool, and defaults toShift(Alt+Shift+ click cuts). Keyboard deletion no longer looks at held modifiers;DeleteNodesIntent()without a mode always usesPathEditorBehavior.nodeRemoval. - Clicking a corner point while holding
bendPointturns it into a smooth point, with handles following the angle of the neighbouring segments.
1.0.0 #
- Modifier mappings can be set to
nullto disable their corresponding behaviours. - Version 1.0.0 release
0.1.0-alpha.3 #
NodeRemoval.preserveHandles, a third way to remove a point. WhereNodeRemoval.preserveShaperefits the handles of the two neighbours so the shape survives, the way Figma and Illustrator do it, the new mode leaves those handles exactly as they are and simply reconnects the path, the way InDesign does it.PathEditorBehavior.nodeRemoval, which picks the mode the editor uses when the user deletes a point without holding the cut modifier.
0.1.0-alpha.2 #
Added #
- Handle selection: clicking a handle selects just that handle, and deleting it collapses it onto its point. Removing the last handle of a point turns it back into a corner, and bend dragging the point grows a symmetric pair again.
0.1.0-alpha.1 #
A rewrite of the editing model and the public API, adding a full pen tool. See the migration table in the README for the 0.0.x equivalents.
Added #
- Pen tool: click to place corner points, click and drag to pull out Bézier handles, click a segment to insert a point, click the first point to close the path.
- Node centric model:
PathNodeowns the two handles around it, so handles can be linked (mirrored,aligned), broken (disconnected) or absent (corner), and nodes convert between those at any time. - Multiple selection, with shift-click toggling and dragging the whole selection.
- Two ways to remove a point:
NodeRemoval.preserveShaperefits the surrounding curve so the shape survives,NodeRemoval.cutbreaks the path. Cuts that would leave more than one open subpath are refused. - Snapping to nodes, segment midpoints and alignment axes, with visual guides, an angle constraint and a modifier to suppress it.
PathEditorThemeDataand thePathEditorThemeinherited widget, with light and dark presets,copyWithandlerp.- A bend interaction: holding
PathEditorModifiers.bendPoint(command on macOS, control elsewhere) drags the curvature out of an existing point instead of moving it, converting a corner point into a smooth one, the way the bend tool works in design tools like Figma. PathEditorBehavior.allowMultipleSubpaths, which stops the pen tool from starting a second disconnected subpath for editors that must produce a single continuous path.PathEditorCursorsfor every contextual state,PathEditorModifiersfor every modifier key,PathEditorShortcutsbuilt on Flutter'sShortcuts/Actions,PathEditorSnappingandPathEditorBehavior.PathEditorViewportwith pan and zoom; hit radii and editing chrome keep a constant size on screen at any zoom level.- Editing callbacks, including
onSegmentCreatedfor opening a stroke panel as the first segment appears. - Transactions (
controller.transaction), so a whole gesture is one undo step, and undo restores the selection it was made with. - Keyboard support: delete, cut, close, finish, select all, nudge, undo, redo and tool switching.
Changed #
- Breaking:
PathEditorControlleris now aChangeNotifierowning the path, the selection and the active tool, built withPathEditorController.fromSvg,.fromPathor.empty. It exposespathListenable,selectionListenableandtoolListenable. - Breaking:
PathPointIndex,PathSegmentIndexandControlPointIndexare replaced byNodeRef,SegmentRefandHandleRef, which address subpaths correctly. - Breaking: the flat styling parameters of
PathEditorare replaced by the configuration objects listed above, andrenderOffsetbyviewport. - Breaking: the default stroke width is now
1(was2) and the active segment highlight is#4E80F9(wasColors.blue). - Inserting a point on a curved segment now splits the curve with de Casteljau's algorithm instead of inserting a straight line, so the shape is unchanged.
- Bounding boxes are computed from exact curve extrema rather than by sampling,
so
BoundsCheckAccuracyis gone. - The editor paints through a single layered painter inside a repaint boundary,
and rebuilds through granular listenables instead of
setStateon every pointer move.
Removed #
- Breaking:
PathHolder,beginUpdate/endUpdate,insertPoint,updatePointPosition,updateControlPointPosition,controlPointsAt,calculateBoundingBox,calculateBoundingBoxOfPathandBoundsCheckAccuracy.
0.0.3 #
- Add bounds calculation
- Add undo redo system
0.0.2 #
- Updates to pubspec
- Live demo with wasm support
0.0.1 #
- Initial version