doodle/lib/ui/dragdrop.go
Noah Petherbridge a316bafb12 Reorganize the package layout
Move all Doodle source code into the src/ subpackage and move the
publicly shareable stuff into lib/, for example lib/ui and lib/render.

This cleans up the git root and helps make the Doodle UI library more
easily publishable as a separate open source project. Currently both
lib/ui and lib/render import one or two things from doodle/src that need
to be broken apart.
2018-12-30 14:22:50 -08:00

29 lines
617 B
Go

package ui
// DragDrop is a state machine to manage draggable UI components.
type DragDrop struct {
isDragging bool
}
// NewDragDrop initializes the DragDrop struct. Normally your Supervisor
// will manage the drag/drop object, but you can use your own if you don't
// use a Supervisor.
func NewDragDrop() *DragDrop {
return &DragDrop{}
}
// IsDragging returns whether the drag state is active.
func (dd *DragDrop) IsDragging() bool {
return dd.isDragging
}
// Start the drag state.
func (dd *DragDrop) Start() {
dd.isDragging = true
}
// Stop dragging.
func (dd *DragDrop) Stop() {
dd.isDragging = false
}