Skip to content

Commit 1331f22

Browse files
some cleanup
1 parent 0feb92c commit 1331f22

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

frontend/src/utility-functions/viewports.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ export function updateBoundsOfViewports(editor: Editor) {
55

66
if (viewports.length <= 0) return;
77

8-
const viewportBounds = viewports[0].getBoundingClientRect();
9-
10-
const left = viewportBounds.left;
11-
const top = viewportBounds.top;
12-
const right = viewportBounds.right;
13-
const bottom = viewportBounds.bottom;
14-
8+
const bounds = viewports[0].getBoundingClientRect();
159
const scale = window.devicePixelRatio || 1;
1610

17-
editor.handle.updateViewport(left, top, right, bottom, scale);
11+
editor.handle.updateViewport(bounds.x, bounds.y, bounds.width, bounds.height, scale);
1812
}

frontend/wasm/src/editor_api.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,7 @@ impl EditorHandle {
518518

519519
/// Send new viewport info to the backend
520520
#[wasm_bindgen(js_name = updateViewport)]
521-
pub fn update_viewport(&self, left: f64, top: f64, right: f64, bottom: f64, scale: f64) {
522-
let x = left;
523-
let y = top;
524-
let width = right - left;
525-
let height = bottom - top;
526-
521+
pub fn update_viewport(&self, x: f64, y: f64, width: f64, height: f64, scale: f64) {
527522
let message = ViewportMessage::Update { x, y, width, height, scale };
528523
self.dispatch(message);
529524
}

0 commit comments

Comments
 (0)