-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove media events from Skiko completely (#892)
This is the skiko part of https://youtrack.jetbrains.com/issue/COMPOSE-1149/wasm-js-Remove-media-events-from-Skiko This commit introduces following changes: * CanvasRenderer is html-agnostic and deals with NativePointer * SkiaLayer does not set any DOM dimensions of the canvas - it's up to the user of the Skia to resolve this dimensions * Media event listeners are removed completely
- Loading branch information
Showing
8 changed files
with
22 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 1 addition & 15 deletions
16
skiko/src/jsMain/kotlin/org/jetbrains/skiko/SkiaLayer.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
package org.jetbrains.skiko | ||
|
||
import kotlinx.browser.window | ||
import org.w3c.dom.AddEventListenerOptions | ||
import org.w3c.dom.MediaQueryListEvent | ||
import org.w3c.dom.events.KeyboardEvent | ||
import org.w3c.dom.events.UIEvent | ||
|
||
actual typealias SkikoGesturePlatformEvent = Any | ||
actual typealias SkikoPlatformInputEvent = KeyboardEvent | ||
actual typealias SkikoPlatformKeyboardEvent = KeyboardEvent | ||
|
||
// MouseEvent is base class of PointerEvent | ||
actual typealias SkikoPlatformPointerEvent = UIEvent | ||
|
||
internal actual fun SkiaLayer.setOnChangeScaleNotifier() { | ||
state?.initCanvas(desiredWidth, desiredHeight, contentScale, this.pixelGeometry) | ||
window.matchMedia("(resolution: ${contentScale}dppx)") | ||
.addEventListener("change", { evt -> | ||
evt as MediaQueryListEvent | ||
if (!evt.matches) { | ||
setOnChangeScaleNotifier() | ||
} | ||
}, AddEventListenerOptions(capture = true, once = true)) | ||
onContentScaleChanged?.invoke(contentScale) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters