Sprites.Media.Binary.Tool

The binary editor's Tools window: the selector that picks the tool and the Windows buttons that open the View and Info panels. It mirrors the map and text editors' Tools window, reusing the shared Sprites.Media.Sprite window parts, and owns its live rect, so a window closed and reopened returns to where it was dragged. Each tool's own window lives in its own module: Sprites.Media.Binary.Tool.Move, Sprites.Media.Binary.Tool.Draw, Sprites.Media.Binary.Tool.Type, Sprites.Media.Binary.Tool.Select, Sprites.Media.Binary.Tool.View and Sprites.Media.Binary.Tool.Info.

Sprites.Media.Binary.Tool

Sprites.Media.Binary.Tool.Selector Void

Sprites.Media.Binary.Tool.Selector(tool)

The canvas tool selector: one button group, one option per tool. Exactly one is selected at a time, and picking an option sets tool, which the editor reads to choose which tool acts on the bytes and which tool window shows. Move pans the view, Draw paints, Type enters values at the caret, and Select marks a range.

InputTypeDescription
toolValueThe two way tool name, one of move, draw, type, select.

Returns nothing.

const tool = Sprites.Reactive.Value('draw');
Sprites.Media.Binary.Tool.Selector(tool);
Sprites.Ui.Dom.Text(' tool = ', tool);
Pick a tool and the chosen name follows.

Sprites.Media.Binary.Tool.Windows Void

Sprites.Media.Binary.Tool.Windows(viewVisible, infoVisible)

The Windows buttons: one secondary button per panel window, View and Info, each opening its window on a click by setting its flag true. They turn nothing off: a panel window carries its own close button, so any number may be open at once.

InputTypeDescription
viewVisibleValueThe View panel's show flag, set true by its button.
infoVisibleValueThe Info panel's show flag, set true by its button.

Returns nothing.

const viewVisible = Sprites.Reactive.Value(false);
const infoVisible = Sprites.Reactive.Value(false);
Sprites.Media.Binary.Tool.Windows(viewVisible, infoVisible);
Sprites.Ui.Dom.Text(' view = ', viewVisible, ' info = ', infoVisible);
Each button opens its panel by setting the flag true.

Sprites.Media.Binary.Tool.Window Void

Sprites.Media.Binary.Tool.Window(tool, viewVisible, infoVisible)

The Tools window: a slim floating window docked to the stage's top left, holding the tool selector over the Windows buttons. It is always shown and has no close button.

InputTypeDescription
toolValueThe two way chosen canvas tool.
viewVisibleValueThe View panel's show flag.
infoVisibleValueThe Info panel's show flag.

Returns nothing.

const tool = Sprites.Reactive.Value('move');
const viewVisible = Sprites.Reactive.Value(false);
const infoVisible = Sprites.Reactive.Value(false);
Sprites.Ui.Content.Area(() => {
  Sprites.Media.Sprite.Tool.Labelled('Tools', () => {
    Sprites.Media.Binary.Tool.Selector(tool);
  });
  Sprites.Media.Sprite.Tool.Labelled('Windows', () => {
    Sprites.Media.Binary.Tool.Windows(viewVisible, infoVisible);
  });
});
The Tools window body, inline: the tool selector over the Windows buttons.