doodle/uix/draw_modes.go
Noah Petherbridge b4a366baa9 Introduce Drawing Tools Concept, Pencil and Actor
The uix.Canvas widget now maintains a selected Tool which configures how
the mouse interacts with the (editable) Canvas widget.

The default Tool is the PencilTool and implements the old behavior: it
draws pixels when clicked and dragged based on your currently selected
Color Swatch. This tool automatically becomes active when you toggle the
Palette tab in the editor mode.

A new Tool is the ActorTool which becomes active when you select the
Doodads tab. In the ActorTool you can't draw pixels on the level, but
when you mouse over a Doodad instance (Actor) in your level, you may
pick it up and drag it someplace else.

Left-click an Actor to pick it up and drag it somewhere else.
Right-click to delete it completely.

You can also delete an Actor by dragging it OFF of the Canvas, like back
onto the palette drawer or onto the menu bar.
2018-10-20 17:08:20 -07:00

20 lines
368 B
Go

package uix
// Tool is a draw mode for an editable Canvas.
type Tool int
// Draw modes for editable Canvas.
const (
PencilTool Tool = iota // draw pixels where the mouse clicks
ActorTool // drag and move actors
)
var toolNames = []string{
"Pencil",
"Doodad", // readable name for ActorTool
}
func (t Tool) String() string {
return toolNames[t]
}