pts 0.1.3

GUI to create, manipulate, and arrange points on a canvas
Documentation

Pts

crates.io documentation MIT/Apache-2.0 licensed pre-commit.ci status

A point canvas with JSON storage

“Points”

Pts is a GUI for creating, manipulating, and arranging points on a canvas.

Points can be:

  • different shapes and switched from one to the other with S + the shape key:
    • C for circle
    • S for square
    • D for diamond (square rotated 45°)
    • H for semi-circle (half-circle)
  • cloned,
    • in-place with C×2
    • in the dirrection of an arrow key with C+{}
  • locked to a grid of lines, toggled with G
  • selected one at a time, or multiple at a time by either:
    • Box selection by holding the mouse to drag a bounding box
    • flood fill (also in B mode) in a particular direction (),
  • saved to JSON (points.json) and re-loaded.

Usage

  • Select single or multiple points with your mouse
  • Draw new points by holding the mouse down in paintbrush mode (P toggles)
  • Drag points with mouse (G toggles snapping to grid)
  • Keyboard-driven workflow

Unimplemented

  • Configure settings via tool TOML in Cargo.toml
  • Publish to crates.io

Installation

cargo install pts
  • Cargo binstall installation is still TODO

Configuration

Create config.toml in the working directory:

bg_color = "#FFFFFF"
point_color = "#000000"
selected_color = "#FF0000"
selection_box_color = "#0000FF"
grid_enabled = true
grid_spacing = 50.0
grid_color = "#CCCCCC"
point_radius = 8.0
move_step = 1.0
move_step_large = 8.0

Controls

Selection

  • Click point: Select single point
  • Click empty: Deselect all
  • B: Toggle box select mode
  • Arrow keys (in box mode): Expand selection to adjacent points
  • Drag box: Select all points entirely within box

Movement

  • Arrow keys: Move selected points by move_step
  • Shift + Arrow: Move by move_step_large
  • Mouse drag: Move selected points (quantized to move_step)

Cloning

  • C then C: Clone selected points on top
  • C then Arrow: Clone adjacent (offset by bounding box size)

Shapes

  • S then S: Set selected points to square
  • S then C: Set selected points to circle
  • S then D: Set selected points to diamond
  • S then H: Set selected points to semi-circle (half-circle)

View

  • G: Toggle snap-to-grid mode
  • V then G: Toggle grid visibility
  • Ctrl + Scroll: Zoom (0.1x to 10x)

Other

  • X: Delete selected points
  • ?: Show help window
  • Ctrl + S: Save points to points.json
  • Ctrl + O: Load points from file
  • Ctrl + R: Reset to defaults
  • Q or Esc: Quit

File Format

Points are saved to points.json in the working directory:

{
  "points": [
    {"id": 1, "x": 200.0, "y": 100.0, "shape": "Circle"},
    {"id": 2, "x": 400.0, "y": 200.0, "shape": "Square"}
    {"id": 3, "x": 600.0, "y": 300.0, "shape": "Diamond"}
  ]
}

Snap to Grid

When snap-to-grid mode is enabled (G), point boundaries snap to the nearest grid lines. The closest edge of each point aligns with grid spacing.

Multi-Selection Behavior

  • Dragging or arrow moving a selected point moves all selected points together
  • Cloning creates copies of all selected points
  • Shape changes apply to all selected points
  • Delete removes all selected points, then selects most recently created remaining point
    • ...often not very well: TOFIX!

Ingredients

Made with:

  • egui (for the easy GUI, naturally)
  • facet (for JSON de/serialisation and application TOML config loading)

Licensing

pts is MIT licensed, a permissive open source license.