Skip to content

Add utility operators/methods to dart:html Point and Rect #9212

Closed as not planned
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


I would like a way to modify Point and Rect with more operators/methods:
  - get a new Point/Rect x pixels to the left/right/up/down.
  - scale a rectangle in either the x or y direction or both
    - This requires some extra information to determine to what point we're scaling. That is, do we scale and leave top left point where it is? Or keep the center where it is? I think this should be an option.
  - get the center of the rectangle, or the center of the sides
  - get the midpoint between two points
    - for that matter, get the centroid of n points.

Currently Point and Rect and special and individualized, I would love to see a generic Shape or Polygon class with any number of points defining the shape. Then you could get centroids, easily create polygon fills on a canvas, make more interesting bounding boxes for a series of shapes, do rotation, etc.

A Line class would be pretty useful, too, actually. Perhaps a Curve class as well. A Path class, as well, which is a sequence of Curves and Lines or the perimeter of a Shape.

What do you think about any of these ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.library-svgtype-enhancementA request for a change that isn't a bugweb-librariesIssues impacting dart:html, etc., libraries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions