LayerResizeHandles class
Handles on the frame of the layer being edited that resize the layer when they're dragged.
The edges and the corners of the frame are dragged by whole tiles, the opposite edge or corner stays where it is. The new frame and its size are shown while dragging, letting go resizes the layer as one step, as ShowResizeLayerDialog() does — a layer that repeats is repeated where it grows, the others get empty tiles. With Ctrl held, a handle moves the whole layer instead, by its offsets in pixels (by whole tiles with Shift too), as one step, but not the sprite layer, which has none. Esc cancels either.
The handles are there only while the selection or the hand is the tool chosen and nothing is being done with it, so they never take a stroke of a tool that paints near the edge of a layer, and not on a locked or hidden layer. Of a layer that repeats, they're on the copy that is framed, see EditorShell.
Constructors, destructors, conversion operators
- LayerResizeHandles(IEditorContext& session, Function<Rectf()>&& getViewRect, Function<Rectf(const LayerView&)>&& getFrame)
- Creates a new instance.
Public functions
- auto IsDragging() const -> bool
- Returns
truewhile a handle is dragged. - void Draw(Painter& painter) override
- auto HitTest(Vector2f pos) -> Element* override
- auto AcceptsPointer() const -> bool override
- auto YieldsToViewGestures() const -> bool override
- auto OnPointerDown(const PointerEvent& event) -> bool override
- void OnPointerMove(const PointerEvent& event) override
- void OnPointerUp(const PointerEvent& event, bool inside) override
- void OnPointerCancel() override
- auto OnKeyPressed(const KeyboardEvent& event) -> bool override
- auto IsFocusable() const -> bool override
- Takes the focus while a handle is dragged, so
Esccancels it. - auto IsTabStop() const -> bool override
- auto GetTooltip(Vector2f pos) const -> StringView override
Function documentation
Jazz2:: Editor:: LayerResizeHandles:: LayerResizeHandles(IEditorContext& session,
Function<Rectf()>&& getViewRect,
Function<Rectf(const LayerView&)>&& getFrame)
Creates a new instance.
getViewRect returns the part of the screen the level is seen in, getFrame where a layer is framed on the screen.