Skip to content

Commit 5c39ab9

Browse files
committed
Workaround for scaling issues
The new side and menu bar provides an additional offset which must be accounted for in the position calculations for the helpDOM There is likely a cleaner way to obtain either the offset itself, or a context transform with the offset included, but the only means I've found so far from my digging is to pull the bounding client rect from the canvas element itself
1 parent 41ca443 commit 5c39ab9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

web/js/VHS.core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ function initHelpDOM() {
191191
const transform = ctx.getTransform();
192192
const scale = app.canvas.ds.scale;//gets the litegraph zoom
193193
//calculate coordinates with account for browser zoom
194-
const x = transform.e*scale/transform.a;
195-
const y = transform.f*scale/transform.a;
194+
const bcr = app.canvas.canvas.getBoundingClientRect()
195+
const x = transform.e*scale/transform.a + bcr.x;
196+
const y = transform.f*scale/transform.a + bcr.y;
196197
//TODO: text reflows at low zoom. investigate alternatives
197198
Object.assign(parentDOM.style, {
198199
left: (x+(n.pos[0] + n.size[0]+15)*scale) + "px",

0 commit comments

Comments
 (0)