Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
williamngan committed May 4, 2024
1 parent e6cae9a commit 47de4b7
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 39 deletions.
3 changes: 2 additions & 1 deletion dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,13 @@ declare class CanvasSpace extends MultiTouchSpace {
protected _canvas: HTMLCanvasElement;
protected _container: Element;
protected _pixelScale: number;
protected _autoResize: boolean;
protected _bgcolor: string;
protected _ctx: PtsCanvasRenderingContext2D;
protected _offscreen: boolean;
protected _offCanvas: HTMLCanvasElement;
protected _offCtx: PtsCanvasRenderingContext2D;
protected _resizeObserver: ResizeObserver;
protected _autoResize: boolean;
protected _initialResize: boolean;
constructor(elem: string | Element, callback?: Function);
protected _createElement(elem: string, id: any): HTMLElement;
Expand Down
3 changes: 2 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,13 @@ declare class CanvasSpace extends MultiTouchSpace {
protected _canvas: HTMLCanvasElement;
protected _container: Element;
protected _pixelScale: number;
protected _autoResize: boolean;
protected _bgcolor: string;
protected _ctx: PtsCanvasRenderingContext2D;
protected _offscreen: boolean;
protected _offCanvas: HTMLCanvasElement;
protected _offCtx: PtsCanvasRenderingContext2D;
protected _resizeObserver: ResizeObserver;
protected _autoResize: boolean;
protected _initialResize: boolean;
constructor(elem: string | Element, callback?: Function);
protected _createElement(elem: string, id: any): HTMLElement;
Expand Down
20 changes: 9 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5863,9 +5863,9 @@ var CanvasSpace2 = class extends MultiTouchSpace {
constructor(elem, callback) {
super();
this._pixelScale = 1;
this._autoResize = true;
this._bgcolor = "#e1e9f0";
this._offscreen = false;
this._autoResize = true;
this._initialResize = false;
let _selector = null;
let _existed = false;
Expand Down Expand Up @@ -5976,13 +5976,15 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* @param auto a boolean value indicating if auto size is set
*/
set autoResize(auto) {
if (!window)
return;
this._autoResize = auto;
if (auto) {
window.addEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver = new ResizeObserver((entries) => {
this._resizeHandler(null);
});
this._resizeObserver.observe(this._container);
} else {
window.removeEventListener("resize", this._resizeHandler.bind(this));
if (this._resizeObserver)
this._resizeObserver.disconnect();
}
}
get autoResize() {
Expand Down Expand Up @@ -6027,12 +6029,10 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* @param evt
*/
_resizeHandler(evt) {
if (!window)
return;
const b = this._autoResize || this._initialResize ? this._container.getBoundingClientRect() : this._canvas.getBoundingClientRect();
if (b) {
const box = Bound.fromBoundingRect(b);
box.center = box.center.add(window.pageXOffset, window.pageYOffset);
box.center = box.center.add((window == null ? void 0 : window.scrollX) || 0, (window == null ? void 0 : window.scrollY) || 0);
this.resize(box, evt);
}
}
Expand Down Expand Up @@ -6159,9 +6159,7 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* Dispose of browser resources held by this space and remove all players. Call this before unmounting the canvas.
*/
dispose() {
if (!window)
return;
window.removeEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver.disconnect();
this.stop();
this.removeAll();
return this;
Expand Down
20 changes: 9 additions & 11 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5795,9 +5795,9 @@ var CanvasSpace2 = class extends MultiTouchSpace {
constructor(elem, callback) {
super();
this._pixelScale = 1;
this._autoResize = true;
this._bgcolor = "#e1e9f0";
this._offscreen = false;
this._autoResize = true;
this._initialResize = false;
let _selector = null;
let _existed = false;
Expand Down Expand Up @@ -5908,13 +5908,15 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* @param auto a boolean value indicating if auto size is set
*/
set autoResize(auto) {
if (!window)
return;
this._autoResize = auto;
if (auto) {
window.addEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver = new ResizeObserver((entries) => {
this._resizeHandler(null);
});
this._resizeObserver.observe(this._container);
} else {
window.removeEventListener("resize", this._resizeHandler.bind(this));
if (this._resizeObserver)
this._resizeObserver.disconnect();
}
}
get autoResize() {
Expand Down Expand Up @@ -5959,12 +5961,10 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* @param evt
*/
_resizeHandler(evt) {
if (!window)
return;
const b = this._autoResize || this._initialResize ? this._container.getBoundingClientRect() : this._canvas.getBoundingClientRect();
if (b) {
const box = Bound.fromBoundingRect(b);
box.center = box.center.add(window.pageXOffset, window.pageYOffset);
box.center = box.center.add((window == null ? void 0 : window.scrollX) || 0, (window == null ? void 0 : window.scrollY) || 0);
this.resize(box, evt);
}
}
Expand Down Expand Up @@ -6091,9 +6091,7 @@ var CanvasSpace2 = class extends MultiTouchSpace {
* Dispose of browser resources held by this space and remove all players. Call this before unmounting the canvas.
*/
dispose() {
if (!window)
return;
window.removeEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver.disconnect();
this.stop();
this.removeAll();
return this;
Expand Down
20 changes: 9 additions & 11 deletions dist/pts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5895,9 +5895,9 @@ See https://github.com/williamngan/pts for details. */
constructor(elem, callback) {
super();
this._pixelScale = 1;
this._autoResize = true;
this._bgcolor = "#e1e9f0";
this._offscreen = false;
this._autoResize = true;
this._initialResize = false;
let _selector = null;
let _existed = false;
Expand Down Expand Up @@ -6008,13 +6008,15 @@ See https://github.com/williamngan/pts for details. */
* @param auto a boolean value indicating if auto size is set
*/
set autoResize(auto) {
if (!window)
return;
this._autoResize = auto;
if (auto) {
window.addEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver = new ResizeObserver((entries) => {
this._resizeHandler(null);
});
this._resizeObserver.observe(this._container);
} else {
window.removeEventListener("resize", this._resizeHandler.bind(this));
if (this._resizeObserver)
this._resizeObserver.disconnect();
}
}
get autoResize() {
Expand Down Expand Up @@ -6059,12 +6061,10 @@ See https://github.com/williamngan/pts for details. */
* @param evt
*/
_resizeHandler(evt) {
if (!window)
return;
const b = this._autoResize || this._initialResize ? this._container.getBoundingClientRect() : this._canvas.getBoundingClientRect();
if (b) {
const box = Bound.fromBoundingRect(b);
box.center = box.center.add(window.pageXOffset, window.pageYOffset);
box.center = box.center.add((window == null ? void 0 : window.scrollX) || 0, (window == null ? void 0 : window.scrollY) || 0);
this.resize(box, evt);
}
}
Expand Down Expand Up @@ -6191,9 +6191,7 @@ See https://github.com/williamngan/pts for details. */
* Dispose of browser resources held by this space and remove all players. Call this before unmounting the canvas.
*/
dispose() {
if (!window)
return;
window.removeEventListener("resize", this._resizeHandler.bind(this));
this._resizeObserver.disconnect();
this.stop();
this.removeAll();
return this;
Expand Down
6 changes: 3 additions & 3 deletions dist/pts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pts.min.js.map

Large diffs are not rendered by default.

0 comments on commit 47de4b7

Please sign in to comment.