Open Domvel opened 5 years ago
Hi, thank you for the feedback.
mouseEvent.point
and group.children
), the same kind of problems were reported here, so please see my answer there for details (will be fixed with https://github.com/paperjs/paper.js/pull/1677).any
, this is a planned incremental improvement that I will try to take care of on a mid-term basis (as it requires to have improved JSDoc features).fullySelected
, indeed, this property is currently only documented for Path
but works for any item at runtime.
As I am not sure about this one, maybe we can ask @lehni: do you think that we should document this for Item
or is it only supposed to be used with Path
?Thanks for quick reply. :) Here's a suggestion about the optional properties of several objects. e.g. Path.
Path
optional properties is type object
. I suggest a more specific type which contains all possible attributes. Where can I see all possible attributes in the docs? Currently:
/**
* Creates a new path item from an object description and places it at the
* top of the active layer.
*
* @param object - an object containing properties to be set on the
* path
*/
constructor(object: object)
The type could be and interface:
enum StrokeCaps {
Round = 'round'
// etc ...
}
interface PathOptions {
segments?: number[][];
strokeWidth?: number;
strokeCap?: StrokeCaps;
selected?: boolean;
// etc ...
}
constructor(properties?: PathOptions)
Segments maybe accept more types like Point[]
and Segment[]
. (?)
strokeCap enum would be great but a string is also ok.
Maybe other similar classes are affected or it's a common property object which should be abstract. (interface extend)
btw. Item.position
should be Point
not Point | null
. Not optional. E.g. Circle (Path). Is position is required and default 0,0. Or really null?
Just a short feedback of a few type issues of the awesome paper.js.
The mouse events of
Tool
areany
type. ThePath
class mouse methods have theMouseEvent
as type.MouseEvent
propertypoint
is typePoint | null
(optional) is this correctly?The property
fullySelected
does not exist on typeGroup
. This is also missing in the documentation. I think it's a forgotten type deklaration. It works on runtime.Group.children
should be initialized with an empty array. Currently it's the typeItem[] | null
. Maybe this is correclty. But I think a Group always have the propertychildrean
and should be initialized with[]
(Array). To avoid optional types. Otherwise in TypeScript strict mode, I have to check it fornull
before accessing. It's a bit annoying. In strict TypeScript you have to set a value on deklaration or in constructor. Otherwise it's option. ...