Skip to content

Commit

Permalink
[MIRROR] Fixes painting [NO GBP] [MDB IGNORE] (#1077)
Browse files Browse the repository at this point in the history
* Fixes painting [NO GBP] (#80233)

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: Jeremiah <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2023
1 parent cbc9583 commit 1209a65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tgui/packages/tgui/interfaces/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ class PaintCanvas extends Component<PaintCanvasProps> {
const y_resolution = this.props.imageHeight || 36;
const x_scale = Math.round(width / x_resolution);
const y_scale = Math.round(height / y_resolution);
const x = Math.floor(event.offsetX / x_scale);
const y = Math.floor(event.offsetY / y_scale);

const rect = canvas.getBoundingClientRect();
const x = Math.floor((event.clientX - rect.left) / x_scale);
const y = Math.floor((event.clientY - rect.top) / y_scale);
return { x, y };
}

Expand Down

0 comments on commit 1209a65

Please sign in to comment.