Skip to content

Commit

Permalink
fix(Graph, Zoom): Ensure correct screen size updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Stukova committed Dec 19, 2024
1 parent e5582f8 commit 279fd0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class Graph {
this.addAttribution()
const w = canvas.clientWidth
const h = canvas.clientHeight
this.store.updateScreenSize(w, h)

canvas.width = w * this.config.pixelRatio
canvas.height = h * this.config.pixelRatio
Expand Down Expand Up @@ -142,7 +143,6 @@ export class Graph {

this.store.maxPointSize = (this.reglInstance.limits.pointSizeDims[1] ?? MAX_POINT_SIZE) / this.config.pixelRatio
this.store.adjustSpaceSize(this.config.spaceSize, this.reglInstance.limits.maxTextureSize)
this.store.updateScreenSize(w, h)

this.points = new Points(this.reglInstance, this.config, this.store, this.graph)
this.lines = new Lines(this.reglInstance, this.config, this.store, this.graph, this.points)
Expand Down
1 change: 1 addition & 0 deletions src/modules/Zoom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Zoom {
const { eventTransform: { x, y, k }, store: { transform, screenSize } } = this
const w = screenSize[0]
const h = screenSize[1]
if (!w || !h) return
mat3.projection(transform, w, h)
mat3.translate(transform, transform, [x, y])
mat3.scale(transform, transform, [k, k])
Expand Down

0 comments on commit 279fd0f

Please sign in to comment.