Skip to content

graphics-2d drawables: text alignment, outline, image crop and pivot #32

Open

Description

@Exeloo

Which package or utils is this feature request for?

components

Feature

The graphics-2d drawables miss options the example games needed (NanoForge-dev/examples#18), each worked around in the game:

  • DrawableText2D (drawable-text-2d.ts): no width or alignment, so a text can't be centered (tic-tac-toe has its own CenterText2D and system); no bold or italic.
  • DrawableRect2D (drawable-rect-2d.ts):
    • no outline-only drawing (stroke without fill);
    • no crop of its image, so no sprite sheets;
    • no pivot: it rotates around its top-left corner, so flappy-bird sets the Konva offset itself to turn the bird around its middle.

Ideal solution or implementation

  • DrawableText2D: width, align (left, center, right), fontStyle.
  • DrawableRect2D: stroke and strokeWidth with an optional fill, crop (x, y, width, height of the image), and a pivot (offsetX/offsetY, or a centered flag) used for rotation.

Alternative solutions or implementations

No response

Other context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions