pts 0.12.8 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -128,13 +128,6 @@ interface MultiTouchElement {
128
128
  addEventListener(evt: any, callback: Function): any;
129
129
  removeEventListener(evt: any, callback: Function): any;
130
130
  }
131
- interface PtsCanvasRenderingContext2D extends CanvasRenderingContext2D {
132
- webkitBackingStorePixelRatio?: number;
133
- mozBackingStorePixelRatio?: number;
134
- msBackingStorePixelRatio?: number;
135
- oBackingStorePixelRatio?: number;
136
- backingStorePixelRatio?: number;
137
- }
138
131
  type CanvasSpaceOptions = {
139
132
  bgcolor?: string;
140
133
  resize?: boolean;
@@ -202,6 +195,7 @@ type DefaultFormStyle = {
202
195
  globalAlpha?: number;
203
196
  };
204
197
  type CanvasPatternRepetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
198
+ type RenderingContext2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
205
199
 
206
200
  /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
207
201
 
@@ -318,14 +312,12 @@ declare class Group extends Array<Pt> {
318
312
  $matrixMultiply(g: GroupLike | number, transposed?: boolean, elementwise?: boolean): Group;
319
313
  zipSlice(index: number, defaultValue?: number | boolean): Pt;
320
314
  $zip(defaultValue?: number | boolean, useLongest?: boolean): Group;
321
- toBound(): Group;
315
+ toBound(): Bound;
322
316
  toString(): string;
323
317
  }
324
318
  declare class Bound extends Group implements IPt {
325
319
  protected _center: Pt;
326
320
  protected _size: Pt;
327
- protected _topLeft: Pt;
328
- protected _bottomRight: Pt;
329
321
  protected _inited: boolean;
330
322
  constructor(...args: Pt[]);
331
323
  static fromBoundingRect(rect: ClientRect): Bound;
@@ -539,7 +531,7 @@ declare class Img {
539
531
  protected _img: HTMLImageElement;
540
532
  protected _data: ImageData;
541
533
  protected _cv: HTMLCanvasElement;
542
- protected _ctx: CanvasRenderingContext2D;
534
+ protected _ctx: RenderingContext2D;
543
535
  protected _scale: number;
544
536
  protected _loaded: boolean;
545
537
  protected _editable: boolean;
@@ -570,7 +562,7 @@ declare class Img {
570
562
  get image(): HTMLImageElement;
571
563
  get canvas(): HTMLCanvasElement;
572
564
  get data(): ImageData;
573
- get ctx(): CanvasRenderingContext2D;
565
+ get ctx(): RenderingContext2D;
574
566
  get loaded(): boolean;
575
567
  get pixelScale(): number;
576
568
  get imageSize(): Pt;
@@ -585,10 +577,10 @@ declare class CanvasSpace extends MultiTouchSpace {
585
577
  protected _container: Element;
586
578
  protected _pixelScale: number;
587
579
  protected _bgcolor: string;
588
- protected _ctx: PtsCanvasRenderingContext2D;
580
+ protected _ctx: CanvasRenderingContext2D;
589
581
  protected _offscreen: boolean;
590
582
  protected _offCanvas: HTMLCanvasElement;
591
- protected _offCtx: PtsCanvasRenderingContext2D;
583
+ protected _offCtx: RenderingContext2D;
592
584
  protected _resizeObserver: ResizeObserver;
593
585
  protected _autoResize: boolean;
594
586
  protected _initialResize: boolean;
@@ -604,13 +596,13 @@ declare class CanvasSpace extends MultiTouchSpace {
604
596
  get background(): string;
605
597
  get pixelScale(): number;
606
598
  get hasOffscreen(): boolean;
607
- get offscreenCtx(): PtsCanvasRenderingContext2D;
599
+ get offscreenCtx(): RenderingContext2D;
608
600
  get offscreenCanvas(): HTMLCanvasElement;
609
601
  getForm(): CanvasForm;
610
602
  get element(): HTMLCanvasElement;
611
603
  get parent(): Element;
612
604
  get ready(): boolean;
613
- get ctx(): PtsCanvasRenderingContext2D;
605
+ get ctx(): CanvasRenderingContext2D;
614
606
  clear(bg?: string): this;
615
607
  clearOffscreen(bg?: string): this;
616
608
  protected playItems(time: number): void;
@@ -619,12 +611,12 @@ declare class CanvasSpace extends MultiTouchSpace {
619
611
  }
620
612
  declare class CanvasForm extends VisualForm {
621
613
  protected _space: CanvasSpace;
622
- protected _ctx: CanvasRenderingContext2D;
614
+ protected _ctx: RenderingContext2D;
623
615
  protected _estimateTextWidth: (string: any) => number;
624
616
  protected _style: DefaultFormStyle;
625
- constructor(space?: CanvasSpace | CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D);
617
+ constructor(space?: CanvasSpace | RenderingContext2D);
626
618
  get space(): CanvasSpace;
627
- get ctx(): PtsCanvasRenderingContext2D;
619
+ get ctx(): RenderingContext2D;
628
620
  useOffscreen(off?: boolean, clear?: boolean | string): this;
629
621
  renderOffscreen(offset?: PtLike): void;
630
622
  alpha(a: number): this;
@@ -644,27 +636,27 @@ declare class CanvasForm extends VisualForm {
644
636
  protected _textAlign(box: PtLikeIterable, vertical: string, offset?: PtLike, center?: Pt): Pt;
645
637
  reset(): this;
646
638
  protected _paint(): void;
647
- static point(ctx: CanvasRenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
639
+ static point(ctx: RenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
648
640
  point(p: PtLike, radius?: number, shape?: string): this;
649
- static circle(ctx: CanvasRenderingContext2D, pt: PtLike, radius?: number): void;
641
+ static circle(ctx: RenderingContext2D, pt: PtLike, radius?: number): void;
650
642
  circle(pts: PtLikeIterable): this;
651
- static ellipse(ctx: CanvasRenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
643
+ static ellipse(ctx: RenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
652
644
  ellipse(pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): this;
653
- static arc(ctx: CanvasRenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
645
+ static arc(ctx: RenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
654
646
  arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
655
- static square(ctx: CanvasRenderingContext2D, pt: PtLike, halfsize: number): void;
647
+ static square(ctx: RenderingContext2D, pt: PtLike, halfsize: number): void;
656
648
  square(pt: PtLike, halfsize: number): this;
657
- static line(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
649
+ static line(ctx: RenderingContext2D, pts: PtLikeIterable): void;
658
650
  line(pts: PtLikeIterable): this;
659
- static polygon(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
651
+ static polygon(ctx: RenderingContext2D, pts: PtLikeIterable): void;
660
652
  polygon(pts: PtLikeIterable): this;
661
- static rect(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
653
+ static rect(ctx: RenderingContext2D, pts: PtLikeIterable): void;
662
654
  rect(pts: PtLikeIterable): this;
663
- static image(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
655
+ static image(ctx: RenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
664
656
  image(ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): this;
665
- static imageData(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
657
+ static imageData(ctx: RenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
666
658
  imageData(ptOrRect: PtLike | PtLikeIterable, img: ImageData): this;
667
- static text(ctx: CanvasRenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
659
+ static text(ctx: RenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
668
660
  text(pt: PtLike, txt: string, maxWidth?: number): this;
669
661
  textBox(box: PtIterable, txt: string, verticalAlign?: string, tail?: string, overrideBaseline?: boolean): this;
670
662
  paragraphBox(box: PtLikeIterable, txt: string, lineHeight?: number, verticalAlign?: string, crop?: boolean): this;
@@ -832,7 +824,7 @@ declare class Rectangle {
832
824
  static from(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
833
825
  static fromTopLeft(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
834
826
  static fromCenter(center: PtLike, widthOrSize: number | PtLike, height?: number): Group;
835
- static toCircle(pts: PtIterable, within?: boolean): Group;
827
+ static toCircle(pts: PtIterable, enclose?: boolean): Group;
836
828
  static toSquare(pts: PtIterable, enclose?: boolean): Group;
837
829
  static size(pts: PtIterable): Pt;
838
830
  static center(pts: PtIterable): Pt;
@@ -1377,4 +1369,4 @@ declare class Sound {
1377
1369
  toggle(): this;
1378
1370
  }
1379
1371
 
1380
- export { type AnimateCallbackFn, Body, Bound, CanvasForm, type CanvasPatternRepetition, CanvasSpace, type CanvasSpaceOptions, Circle, Color, type ColorType, Const, Create, Curve, type DOMFormContext, DOMSpace, type DefaultFormStyle, Delaunay, type DelaunayMesh, type DelaunayShape, Font, Form, Geom, Group, type GroupLike, HTMLForm, HTMLSpace, type IPlayer, type IPt, type ISoundAnalyzer, type ISpacePlayers, type ITempoListener, type ITempoProgressFn, type ITempoResponses, type ITempoStartFn, type ITimer, Img, type IntersectContext, Line, Mat, type MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, type PtIterable, type PtLike, type PtLikeIterable, type PtsCanvasRenderingContext2D, Range, Rectangle, SVGForm, SVGSpace, Shaping, Sound, type SoundType, Space, Tempo, type TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, type UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, type WarningType, World };
1372
+ export { type AnimateCallbackFn, Body, Bound, CanvasForm, type CanvasPatternRepetition, CanvasSpace, type CanvasSpaceOptions, Circle, Color, type ColorType, Const, Create, Curve, type DOMFormContext, DOMSpace, type DefaultFormStyle, Delaunay, type DelaunayMesh, type DelaunayShape, Font, Form, Geom, Group, type GroupLike, HTMLForm, HTMLSpace, type IPlayer, type IPt, type ISoundAnalyzer, type ISpacePlayers, type ITempoListener, type ITempoProgressFn, type ITempoResponses, type ITempoStartFn, type ITimer, Img, type IntersectContext, Line, Mat, type MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, type PtIterable, type PtLike, type PtLikeIterable, Range, Rectangle, type RenderingContext2D, SVGForm, SVGSpace, Shaping, Sound, type SoundType, Space, Tempo, type TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, type UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, type WarningType, World };
package/dist/index.d.ts CHANGED
@@ -128,13 +128,6 @@ interface MultiTouchElement {
128
128
  addEventListener(evt: any, callback: Function): any;
129
129
  removeEventListener(evt: any, callback: Function): any;
130
130
  }
131
- interface PtsCanvasRenderingContext2D extends CanvasRenderingContext2D {
132
- webkitBackingStorePixelRatio?: number;
133
- mozBackingStorePixelRatio?: number;
134
- msBackingStorePixelRatio?: number;
135
- oBackingStorePixelRatio?: number;
136
- backingStorePixelRatio?: number;
137
- }
138
131
  type CanvasSpaceOptions = {
139
132
  bgcolor?: string;
140
133
  resize?: boolean;
@@ -202,6 +195,7 @@ type DefaultFormStyle = {
202
195
  globalAlpha?: number;
203
196
  };
204
197
  type CanvasPatternRepetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
198
+ type RenderingContext2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
205
199
 
206
200
  /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
207
201
 
@@ -318,14 +312,12 @@ declare class Group extends Array<Pt> {
318
312
  $matrixMultiply(g: GroupLike | number, transposed?: boolean, elementwise?: boolean): Group;
319
313
  zipSlice(index: number, defaultValue?: number | boolean): Pt;
320
314
  $zip(defaultValue?: number | boolean, useLongest?: boolean): Group;
321
- toBound(): Group;
315
+ toBound(): Bound;
322
316
  toString(): string;
323
317
  }
324
318
  declare class Bound extends Group implements IPt {
325
319
  protected _center: Pt;
326
320
  protected _size: Pt;
327
- protected _topLeft: Pt;
328
- protected _bottomRight: Pt;
329
321
  protected _inited: boolean;
330
322
  constructor(...args: Pt[]);
331
323
  static fromBoundingRect(rect: ClientRect): Bound;
@@ -539,7 +531,7 @@ declare class Img {
539
531
  protected _img: HTMLImageElement;
540
532
  protected _data: ImageData;
541
533
  protected _cv: HTMLCanvasElement;
542
- protected _ctx: CanvasRenderingContext2D;
534
+ protected _ctx: RenderingContext2D;
543
535
  protected _scale: number;
544
536
  protected _loaded: boolean;
545
537
  protected _editable: boolean;
@@ -570,7 +562,7 @@ declare class Img {
570
562
  get image(): HTMLImageElement;
571
563
  get canvas(): HTMLCanvasElement;
572
564
  get data(): ImageData;
573
- get ctx(): CanvasRenderingContext2D;
565
+ get ctx(): RenderingContext2D;
574
566
  get loaded(): boolean;
575
567
  get pixelScale(): number;
576
568
  get imageSize(): Pt;
@@ -585,10 +577,10 @@ declare class CanvasSpace extends MultiTouchSpace {
585
577
  protected _container: Element;
586
578
  protected _pixelScale: number;
587
579
  protected _bgcolor: string;
588
- protected _ctx: PtsCanvasRenderingContext2D;
580
+ protected _ctx: CanvasRenderingContext2D;
589
581
  protected _offscreen: boolean;
590
582
  protected _offCanvas: HTMLCanvasElement;
591
- protected _offCtx: PtsCanvasRenderingContext2D;
583
+ protected _offCtx: RenderingContext2D;
592
584
  protected _resizeObserver: ResizeObserver;
593
585
  protected _autoResize: boolean;
594
586
  protected _initialResize: boolean;
@@ -604,13 +596,13 @@ declare class CanvasSpace extends MultiTouchSpace {
604
596
  get background(): string;
605
597
  get pixelScale(): number;
606
598
  get hasOffscreen(): boolean;
607
- get offscreenCtx(): PtsCanvasRenderingContext2D;
599
+ get offscreenCtx(): RenderingContext2D;
608
600
  get offscreenCanvas(): HTMLCanvasElement;
609
601
  getForm(): CanvasForm;
610
602
  get element(): HTMLCanvasElement;
611
603
  get parent(): Element;
612
604
  get ready(): boolean;
613
- get ctx(): PtsCanvasRenderingContext2D;
605
+ get ctx(): CanvasRenderingContext2D;
614
606
  clear(bg?: string): this;
615
607
  clearOffscreen(bg?: string): this;
616
608
  protected playItems(time: number): void;
@@ -619,12 +611,12 @@ declare class CanvasSpace extends MultiTouchSpace {
619
611
  }
620
612
  declare class CanvasForm extends VisualForm {
621
613
  protected _space: CanvasSpace;
622
- protected _ctx: CanvasRenderingContext2D;
614
+ protected _ctx: RenderingContext2D;
623
615
  protected _estimateTextWidth: (string: any) => number;
624
616
  protected _style: DefaultFormStyle;
625
- constructor(space?: CanvasSpace | CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D);
617
+ constructor(space?: CanvasSpace | RenderingContext2D);
626
618
  get space(): CanvasSpace;
627
- get ctx(): PtsCanvasRenderingContext2D;
619
+ get ctx(): RenderingContext2D;
628
620
  useOffscreen(off?: boolean, clear?: boolean | string): this;
629
621
  renderOffscreen(offset?: PtLike): void;
630
622
  alpha(a: number): this;
@@ -644,27 +636,27 @@ declare class CanvasForm extends VisualForm {
644
636
  protected _textAlign(box: PtLikeIterable, vertical: string, offset?: PtLike, center?: Pt): Pt;
645
637
  reset(): this;
646
638
  protected _paint(): void;
647
- static point(ctx: CanvasRenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
639
+ static point(ctx: RenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
648
640
  point(p: PtLike, radius?: number, shape?: string): this;
649
- static circle(ctx: CanvasRenderingContext2D, pt: PtLike, radius?: number): void;
641
+ static circle(ctx: RenderingContext2D, pt: PtLike, radius?: number): void;
650
642
  circle(pts: PtLikeIterable): this;
651
- static ellipse(ctx: CanvasRenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
643
+ static ellipse(ctx: RenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
652
644
  ellipse(pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): this;
653
- static arc(ctx: CanvasRenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
645
+ static arc(ctx: RenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
654
646
  arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
655
- static square(ctx: CanvasRenderingContext2D, pt: PtLike, halfsize: number): void;
647
+ static square(ctx: RenderingContext2D, pt: PtLike, halfsize: number): void;
656
648
  square(pt: PtLike, halfsize: number): this;
657
- static line(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
649
+ static line(ctx: RenderingContext2D, pts: PtLikeIterable): void;
658
650
  line(pts: PtLikeIterable): this;
659
- static polygon(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
651
+ static polygon(ctx: RenderingContext2D, pts: PtLikeIterable): void;
660
652
  polygon(pts: PtLikeIterable): this;
661
- static rect(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
653
+ static rect(ctx: RenderingContext2D, pts: PtLikeIterable): void;
662
654
  rect(pts: PtLikeIterable): this;
663
- static image(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
655
+ static image(ctx: RenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
664
656
  image(ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): this;
665
- static imageData(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
657
+ static imageData(ctx: RenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
666
658
  imageData(ptOrRect: PtLike | PtLikeIterable, img: ImageData): this;
667
- static text(ctx: CanvasRenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
659
+ static text(ctx: RenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
668
660
  text(pt: PtLike, txt: string, maxWidth?: number): this;
669
661
  textBox(box: PtIterable, txt: string, verticalAlign?: string, tail?: string, overrideBaseline?: boolean): this;
670
662
  paragraphBox(box: PtLikeIterable, txt: string, lineHeight?: number, verticalAlign?: string, crop?: boolean): this;
@@ -832,7 +824,7 @@ declare class Rectangle {
832
824
  static from(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
833
825
  static fromTopLeft(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
834
826
  static fromCenter(center: PtLike, widthOrSize: number | PtLike, height?: number): Group;
835
- static toCircle(pts: PtIterable, within?: boolean): Group;
827
+ static toCircle(pts: PtIterable, enclose?: boolean): Group;
836
828
  static toSquare(pts: PtIterable, enclose?: boolean): Group;
837
829
  static size(pts: PtIterable): Pt;
838
830
  static center(pts: PtIterable): Pt;
@@ -1377,4 +1369,4 @@ declare class Sound {
1377
1369
  toggle(): this;
1378
1370
  }
1379
1371
 
1380
- export { type AnimateCallbackFn, Body, Bound, CanvasForm, type CanvasPatternRepetition, CanvasSpace, type CanvasSpaceOptions, Circle, Color, type ColorType, Const, Create, Curve, type DOMFormContext, DOMSpace, type DefaultFormStyle, Delaunay, type DelaunayMesh, type DelaunayShape, Font, Form, Geom, Group, type GroupLike, HTMLForm, HTMLSpace, type IPlayer, type IPt, type ISoundAnalyzer, type ISpacePlayers, type ITempoListener, type ITempoProgressFn, type ITempoResponses, type ITempoStartFn, type ITimer, Img, type IntersectContext, Line, Mat, type MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, type PtIterable, type PtLike, type PtLikeIterable, type PtsCanvasRenderingContext2D, Range, Rectangle, SVGForm, SVGSpace, Shaping, Sound, type SoundType, Space, Tempo, type TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, type UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, type WarningType, World };
1372
+ export { type AnimateCallbackFn, Body, Bound, CanvasForm, type CanvasPatternRepetition, CanvasSpace, type CanvasSpaceOptions, Circle, Color, type ColorType, Const, Create, Curve, type DOMFormContext, DOMSpace, type DefaultFormStyle, Delaunay, type DelaunayMesh, type DelaunayShape, Font, Form, Geom, Group, type GroupLike, HTMLForm, HTMLSpace, type IPlayer, type IPt, type ISoundAnalyzer, type ISpacePlayers, type ITempoListener, type ITempoProgressFn, type ITempoResponses, type ITempoStartFn, type ITimer, Img, type IntersectContext, Line, Mat, type MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, type PtIterable, type PtLike, type PtLikeIterable, Range, Rectangle, type RenderingContext2D, SVGForm, SVGSpace, Shaping, Sound, type SoundType, Space, Tempo, type TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, type UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, type WarningType, World };
package/dist/index.js CHANGED
@@ -892,11 +892,11 @@ var Rectangle = class _Rectangle {
892
892
  /**
893
893
  * Create a new circle that either fits within or encloses the rectangle. Same as [`Circle.fromRect`](#link).
894
894
  * @param pts a Group or an Iterable<Pt> with 2 Pt representing a rectangle
895
- * @param within if `true`, the circle will be within the rectangle. If `false`, the circle will enclose the rectangle.
895
+ * @param enclose if `true`, the circle will enclose the rectangle. If `false`, the circle will fit inside the rectangle.
896
896
  * @returns a Group that represents a circle
897
897
  */
898
- static toCircle(pts, within = true) {
899
- return Circle.fromRect(pts, within);
898
+ static toCircle(pts, enclose = true) {
899
+ return Circle.fromRect(pts, enclose);
900
900
  }
901
901
  /**
902
902
  * Create a square that either fits within or encloses a rectangle.
@@ -4092,8 +4092,6 @@ var Bound = class _Bound extends Group {
4092
4092
  super(...args);
4093
4093
  this._center = new Pt();
4094
4094
  this._size = new Pt();
4095
- this._topLeft = new Pt();
4096
- this._bottomRight = new Pt();
4097
4095
  this._inited = false;
4098
4096
  this.init();
4099
4097
  }
@@ -4127,10 +4125,6 @@ var Bound = class _Bound extends Group {
4127
4125
  this._inited = true;
4128
4126
  }
4129
4127
  if (this.p1 && this.p2) {
4130
- const a = this.p1;
4131
- const b = this.p2;
4132
- this.topLeft = a.$min(b);
4133
- this._bottomRight = a.$max(b);
4134
4128
  this._updateSize();
4135
4129
  this._inited = true;
4136
4130
  }
@@ -4139,33 +4133,33 @@ var Bound = class _Bound extends Group {
4139
4133
  * Clone this bound and return a new one.
4140
4134
  */
4141
4135
  clone() {
4142
- return new _Bound(this._topLeft.clone(), this._bottomRight.clone());
4136
+ return new _Bound(this.topLeft.clone(), this.bottomRight.clone());
4143
4137
  }
4144
4138
  /**
4145
4139
  * Recalculte size and center.
4146
4140
  */
4147
4141
  _updateSize() {
4148
- this._size = this._bottomRight.$subtract(this._topLeft).abs();
4142
+ this._size = this.bottomRight.$subtract(this.topLeft).abs();
4149
4143
  this._updateCenter();
4150
4144
  }
4151
4145
  /**
4152
4146
  * Recalculate center.
4153
4147
  */
4154
4148
  _updateCenter() {
4155
- this._center = this._size.$multiply(0.5).add(this._topLeft);
4149
+ this._center = this._size.$multiply(0.5).add(this.topLeft);
4156
4150
  }
4157
4151
  /**
4158
4152
  * Recalculate based on top-left position and size.
4159
4153
  */
4160
4154
  _updatePosFromTop() {
4161
- this._bottomRight = this._topLeft.$add(this._size);
4155
+ this.bottomRight = this.topLeft.$add(this._size);
4162
4156
  this._updateCenter();
4163
4157
  }
4164
4158
  /**
4165
4159
  * Recalculate based on bottom-right position and size.
4166
4160
  */
4167
4161
  _updatePosFromBottom() {
4168
- this._topLeft = this._bottomRight.$subtract(this._size);
4162
+ this.topLeft = this.bottomRight.$subtract(this._size);
4169
4163
  this._updateCenter();
4170
4164
  }
4171
4165
  /**
@@ -4173,8 +4167,8 @@ var Bound = class _Bound extends Group {
4173
4167
  */
4174
4168
  _updatePosFromCenter() {
4175
4169
  const half = this._size.$multiply(0.5);
4176
- this._topLeft = this._center.$subtract(half);
4177
- this._bottomRight = this._center.$add(half);
4170
+ this.topLeft = this._center.$subtract(half);
4171
+ this.bottomRight = this._center.$add(half);
4178
4172
  }
4179
4173
  /**
4180
4174
  * Size of this Bound
@@ -4200,22 +4194,20 @@ var Bound = class _Bound extends Group {
4200
4194
  * Top-left position of this Bound
4201
4195
  */
4202
4196
  get topLeft() {
4203
- return new Pt(this._topLeft);
4197
+ return new Pt(this[0]);
4204
4198
  }
4205
4199
  set topLeft(p) {
4206
- this._topLeft = new Pt(p);
4207
- this[0] = this._topLeft;
4200
+ this[0] = new Pt(p);
4208
4201
  this._updateSize();
4209
4202
  }
4210
4203
  /**
4211
4204
  * Bottom-right position of this Bound
4212
4205
  */
4213
4206
  get bottomRight() {
4214
- return new Pt(this._bottomRight);
4207
+ return new Pt(this[1]);
4215
4208
  }
4216
4209
  set bottomRight(p) {
4217
- this._bottomRight = new Pt(p);
4218
- this[1] = this._bottomRight;
4210
+ this[1] = new Pt(p);
4219
4211
  this._updateSize();
4220
4212
  }
4221
4213
  /**
@@ -4277,8 +4269,8 @@ var Bound = class _Bound extends Group {
4277
4269
  * It's simpler and preferable to change the Bound's properties (eg, topLeft, bottomRight) instead of updating the Bound's Pts.
4278
4270
  */
4279
4271
  update() {
4280
- this._topLeft = this[0];
4281
- this._bottomRight = this[1];
4272
+ this.topLeft = this[0];
4273
+ this.bottomRight = this[1];
4282
4274
  this._updateSize();
4283
4275
  return this;
4284
4276
  }
@@ -5956,8 +5948,7 @@ var CanvasSpace2 = class extends MultiTouchSpace {
5956
5948
  this.autoResize = opt.resize != void 0 ? opt.resize : false;
5957
5949
  if (opt.retina !== false) {
5958
5950
  const r1 = window ? window.devicePixelRatio || 1 : 1;
5959
- const r2 = this._ctx.webkitBackingStorePixelRatio || this._ctx.mozBackingStorePixelRatio || this._ctx.msBackingStorePixelRatio || this._ctx.oBackingStorePixelRatio || this._ctx.backingStorePixelRatio || 1;
5960
- this._pixelScale = Math.max(1, r1 / r2);
5951
+ this._pixelScale = Math.max(1, r1);
5961
5952
  }
5962
5953
  if (opt.offscreen) {
5963
5954
  this._offscreen = true;
package/dist/index.mjs CHANGED
@@ -824,11 +824,11 @@ var Rectangle = class _Rectangle {
824
824
  /**
825
825
  * Create a new circle that either fits within or encloses the rectangle. Same as [`Circle.fromRect`](#link).
826
826
  * @param pts a Group or an Iterable<Pt> with 2 Pt representing a rectangle
827
- * @param within if `true`, the circle will be within the rectangle. If `false`, the circle will enclose the rectangle.
827
+ * @param enclose if `true`, the circle will enclose the rectangle. If `false`, the circle will fit inside the rectangle.
828
828
  * @returns a Group that represents a circle
829
829
  */
830
- static toCircle(pts, within = true) {
831
- return Circle.fromRect(pts, within);
830
+ static toCircle(pts, enclose = true) {
831
+ return Circle.fromRect(pts, enclose);
832
832
  }
833
833
  /**
834
834
  * Create a square that either fits within or encloses a rectangle.
@@ -4024,8 +4024,6 @@ var Bound = class _Bound extends Group {
4024
4024
  super(...args);
4025
4025
  this._center = new Pt();
4026
4026
  this._size = new Pt();
4027
- this._topLeft = new Pt();
4028
- this._bottomRight = new Pt();
4029
4027
  this._inited = false;
4030
4028
  this.init();
4031
4029
  }
@@ -4059,10 +4057,6 @@ var Bound = class _Bound extends Group {
4059
4057
  this._inited = true;
4060
4058
  }
4061
4059
  if (this.p1 && this.p2) {
4062
- const a = this.p1;
4063
- const b = this.p2;
4064
- this.topLeft = a.$min(b);
4065
- this._bottomRight = a.$max(b);
4066
4060
  this._updateSize();
4067
4061
  this._inited = true;
4068
4062
  }
@@ -4071,33 +4065,33 @@ var Bound = class _Bound extends Group {
4071
4065
  * Clone this bound and return a new one.
4072
4066
  */
4073
4067
  clone() {
4074
- return new _Bound(this._topLeft.clone(), this._bottomRight.clone());
4068
+ return new _Bound(this.topLeft.clone(), this.bottomRight.clone());
4075
4069
  }
4076
4070
  /**
4077
4071
  * Recalculte size and center.
4078
4072
  */
4079
4073
  _updateSize() {
4080
- this._size = this._bottomRight.$subtract(this._topLeft).abs();
4074
+ this._size = this.bottomRight.$subtract(this.topLeft).abs();
4081
4075
  this._updateCenter();
4082
4076
  }
4083
4077
  /**
4084
4078
  * Recalculate center.
4085
4079
  */
4086
4080
  _updateCenter() {
4087
- this._center = this._size.$multiply(0.5).add(this._topLeft);
4081
+ this._center = this._size.$multiply(0.5).add(this.topLeft);
4088
4082
  }
4089
4083
  /**
4090
4084
  * Recalculate based on top-left position and size.
4091
4085
  */
4092
4086
  _updatePosFromTop() {
4093
- this._bottomRight = this._topLeft.$add(this._size);
4087
+ this.bottomRight = this.topLeft.$add(this._size);
4094
4088
  this._updateCenter();
4095
4089
  }
4096
4090
  /**
4097
4091
  * Recalculate based on bottom-right position and size.
4098
4092
  */
4099
4093
  _updatePosFromBottom() {
4100
- this._topLeft = this._bottomRight.$subtract(this._size);
4094
+ this.topLeft = this.bottomRight.$subtract(this._size);
4101
4095
  this._updateCenter();
4102
4096
  }
4103
4097
  /**
@@ -4105,8 +4099,8 @@ var Bound = class _Bound extends Group {
4105
4099
  */
4106
4100
  _updatePosFromCenter() {
4107
4101
  const half = this._size.$multiply(0.5);
4108
- this._topLeft = this._center.$subtract(half);
4109
- this._bottomRight = this._center.$add(half);
4102
+ this.topLeft = this._center.$subtract(half);
4103
+ this.bottomRight = this._center.$add(half);
4110
4104
  }
4111
4105
  /**
4112
4106
  * Size of this Bound
@@ -4132,22 +4126,20 @@ var Bound = class _Bound extends Group {
4132
4126
  * Top-left position of this Bound
4133
4127
  */
4134
4128
  get topLeft() {
4135
- return new Pt(this._topLeft);
4129
+ return new Pt(this[0]);
4136
4130
  }
4137
4131
  set topLeft(p) {
4138
- this._topLeft = new Pt(p);
4139
- this[0] = this._topLeft;
4132
+ this[0] = new Pt(p);
4140
4133
  this._updateSize();
4141
4134
  }
4142
4135
  /**
4143
4136
  * Bottom-right position of this Bound
4144
4137
  */
4145
4138
  get bottomRight() {
4146
- return new Pt(this._bottomRight);
4139
+ return new Pt(this[1]);
4147
4140
  }
4148
4141
  set bottomRight(p) {
4149
- this._bottomRight = new Pt(p);
4150
- this[1] = this._bottomRight;
4142
+ this[1] = new Pt(p);
4151
4143
  this._updateSize();
4152
4144
  }
4153
4145
  /**
@@ -4209,8 +4201,8 @@ var Bound = class _Bound extends Group {
4209
4201
  * It's simpler and preferable to change the Bound's properties (eg, topLeft, bottomRight) instead of updating the Bound's Pts.
4210
4202
  */
4211
4203
  update() {
4212
- this._topLeft = this[0];
4213
- this._bottomRight = this[1];
4204
+ this.topLeft = this[0];
4205
+ this.bottomRight = this[1];
4214
4206
  this._updateSize();
4215
4207
  return this;
4216
4208
  }
@@ -5888,8 +5880,7 @@ var CanvasSpace2 = class extends MultiTouchSpace {
5888
5880
  this.autoResize = opt.resize != void 0 ? opt.resize : false;
5889
5881
  if (opt.retina !== false) {
5890
5882
  const r1 = window ? window.devicePixelRatio || 1 : 1;
5891
- const r2 = this._ctx.webkitBackingStorePixelRatio || this._ctx.mozBackingStorePixelRatio || this._ctx.msBackingStorePixelRatio || this._ctx.oBackingStorePixelRatio || this._ctx.backingStorePixelRatio || 1;
5892
- this._pixelScale = Math.max(1, r1 / r2);
5883
+ this._pixelScale = Math.max(1, r1);
5893
5884
  }
5894
5885
  if (opt.offscreen) {
5895
5886
  this._offscreen = true;