Skip to content

Commit cbc4d1a

Browse files
committed
resizing window when scale is changed
1 parent f79f091 commit cbc4d1a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

ui/src/app/services/ui.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,19 @@ export class UIService extends DataService {
188188
}
189189

190190
async setScale (scale: number) {
191+
const oldScale = this.scale
191192
this.scale = scale
192-
return this.request({ method: 'POST', endpoint: '/scale', data: { scale } })
193+
let [ height, width ] = await Promise.all([
194+
this.getHeight(),
195+
this.getWidth()
196+
])
197+
height = scale * height / oldScale
198+
width = scale * width / oldScale
199+
await this.request({ method: 'POST', endpoint: '/scale', data: { scale } })
200+
await Promise.all([
201+
this.setHeight(height),
202+
this.setWidth(width)
203+
])
193204
}
194205

195206
async getMinHeight (): Promise<number> {

0 commit comments

Comments
 (0)