Skip to content

Commit

Permalink
fix(display_context): fix incorrect offsets and scaling when renderin…
Browse files Browse the repository at this point in the history
…g panels

This fixes a bug introduced by cc6fdc9.
  • Loading branch information
jbms committed Aug 20, 2018
1 parent f45a7d5 commit 775a883
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/neuroglancer/display_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export abstract class RenderedPanel extends RefCounted {
let element = this.element;
const clientRect = element.getBoundingClientRect();
const canvasRect = this.context.canvasRect!;
const scaleX = element.clientWidth / clientRect.width;
const scaleY = element.clientHeight / clientRect.height;
const scaleX = canvasRect.width / this.context.canvas.width;
const scaleY = canvasRect.height / this.context.canvas.height;
let left = (element.clientLeft + clientRect.left - canvasRect.left) * scaleX;
let width = element.clientWidth;
let top = (clientRect.top - canvasRect.top + element.clientTop) * scaleY;
Expand Down

0 comments on commit 775a883

Please sign in to comment.