Add utility operators/methods to dart:html Point and Rect #9212
Labels
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
library-svg
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
web-libraries
Issues impacting dart:html, etc., libraries
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?
The text was updated successfully, but these errors were encountered: