|
@@ -1672,7 +1672,10 @@ class WindowManager extends WebviewWindowHandle {
|
|
|
* @since 1.0.2
|
|
|
*/
|
|
|
async onResized(handler: EventCallback<PhysicalSize>): Promise<UnlistenFn> {
|
|
|
- return this.listen<PhysicalSize>(TauriEvent.WINDOW_RESIZED, handler)
|
|
|
+ return this.listen<PhysicalSize>(TauriEvent.WINDOW_RESIZED, (e) => {
|
|
|
+ e.payload = mapPhysicalSize(e.payload)
|
|
|
+ handler(e)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1695,7 +1698,10 @@ class WindowManager extends WebviewWindowHandle {
|
|
|
* @since 1.0.2
|
|
|
*/
|
|
|
async onMoved(handler: EventCallback<PhysicalPosition>): Promise<UnlistenFn> {
|
|
|
- return this.listen<PhysicalPosition>(TauriEvent.WINDOW_MOVED, handler)
|
|
|
+ return this.listen<PhysicalPosition>(TauriEvent.WINDOW_MOVED, (e) => {
|
|
|
+ e.payload = mapPhysicalPosition(e.payload)
|
|
|
+ handler(e)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2154,11 +2160,19 @@ function mapMonitor(m: Monitor | null): Monitor | null {
|
|
|
: {
|
|
|
name: m.name,
|
|
|
scaleFactor: m.scaleFactor,
|
|
|
- position: new PhysicalPosition(m.position.x, m.position.y),
|
|
|
- size: new PhysicalSize(m.size.width, m.size.height)
|
|
|
+ position: mapPhysicalPosition(m.position),
|
|
|
+ size: mapPhysicalSize(m.size)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function mapPhysicalPosition(m: PhysicalPosition): PhysicalPosition {
|
|
|
+ return new PhysicalPosition(m.x, m.y)
|
|
|
+}
|
|
|
+
|
|
|
+function mapPhysicalSize(m: PhysicalSize): PhysicalSize {
|
|
|
+ return new PhysicalSize(m.width, m.height)
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Returns the monitor on which the window currently resides.
|
|
|
* Returns `null` if current monitor can't be detected.
|