Skip to content

Commit

Permalink
fix: touch and pointer behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkzt committed May 21, 2020
1 parent 0cb1696 commit 17d1c75
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,28 @@ export class Renderer extends Svg {
public resizeElement(param?: DOMRect) {
const { width, height, left, top } =
param || this.el.getBoundingClientRect()
if (this.width !== width) {
// TODO: Resizing improve
this.scalePath(width / this.width)
}
// TODO: Resizing improve
this.scalePath(width / this.width)
this.width = width
this.height = height
this.left = left
this.top = top
this.update()
}

private _setupAdjustResize() {
if ((window as any).ResizeObserver) {
const resizeObserver: any = new (window as any).ResizeObserver(
(entries: any[]) => {
this.resizeElement(entries[0].contentRect)
this.update()
}
)
resizeObserver.observe(this.el)
} else {
// TODO: improve
window.addEventListener('resize', _ev => {
this.resizeElement(this.el.getBoundingClientRect())
this.update()
})
}
}
Expand Down

0 comments on commit 17d1c75

Please sign in to comment.