update handle_event method

This commit is contained in:
aOK 2024-09-20 19:50:25 +03:00
parent 5bf207ee08
commit a93c31c9e7
4 changed files with 181 additions and 3 deletions

180
Cargo.lock generated
View file

@ -20,6 +20,15 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.8" version = "0.3.8"
@ -68,6 +77,15 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "convert_case"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.4.2" version = "1.4.2"
@ -77,6 +95,16 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "ctor"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn",
]
[[package]] [[package]]
name = "data-url" name = "data-url"
version = "0.3.1" version = "0.3.1"
@ -117,6 +145,12 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "hilog-sys"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de0e35e8534a70b5af5ccc943ffa3e2dcfe481b2b983c9fd514d7421a46b69e"
[[package]] [[package]]
name = "imagesize" name = "imagesize"
version = "0.12.0" version = "0.12.0"
@ -133,6 +167,16 @@ dependencies = [
"smallvec", "smallvec",
] ]
[[package]]
name = "libloading"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets",
]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.22" version = "0.4.22"
@ -263,6 +307,7 @@ version = "0.4.0"
name = "makepad-micro-serde" name = "makepad-micro-serde"
version = "0.4.0" version = "0.4.0"
dependencies = [ dependencies = [
"makepad-live-id",
"makepad-micro-serde-derive", "makepad-micro-serde-derive",
] ]
@ -281,6 +326,7 @@ version = "0.4.0"
name = "makepad-platform" name = "makepad-platform"
version = "0.6.0" version = "0.6.0"
dependencies = [ dependencies = [
"hilog-sys",
"makepad-android-state", "makepad-android-state",
"makepad-futures", "makepad-futures",
"makepad-futures-legacy", "makepad-futures-legacy",
@ -290,6 +336,9 @@ dependencies = [
"makepad-shader-compiler", "makepad-shader-compiler",
"makepad-wasm-bridge", "makepad-wasm-bridge",
"makepad-windows", "makepad-windows",
"napi-derive-ohos",
"napi-ohos",
"ohos-sys",
"smallvec", "smallvec",
"windows-targets", "windows-targets",
] ]
@ -381,6 +430,12 @@ dependencies = [
"makepad-zune-inflate", "makepad-zune-inflate",
] ]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.4" version = "0.7.4"
@ -407,6 +462,67 @@ dependencies = [
"makepad-widgets", "makepad-widgets",
] ]
[[package]]
name = "napi-derive-backend-ohos"
version = "0.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b18d697bedddd2d4c9f8f76b49fe65bd81ed1c55a7eec21ba40c176c236ddc"
dependencies = [
"convert_case",
"once_cell",
"proc-macro2",
"quote",
"regex",
"syn",
]
[[package]]
name = "napi-derive-ohos"
version = "0.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8462d74a2d6c7a671bd610f99f9ba34c739aadd2da4d8dd9f109a7e666cc2ad2"
dependencies = [
"cfg-if",
"convert_case",
"napi-derive-backend-ohos",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "napi-ohos"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad5a3bbb2ae61f345b8c11776f2e79fc2bb71d1901af9a5f81f03c9238a05d86"
dependencies = [
"bitflags 2.6.0",
"ctor",
"napi-sys-ohos",
"once_cell",
]
[[package]]
name = "napi-sys-ohos"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f101404db01422d034db5afa63eefff6d9c8f66c0894278bc456b4c30954e166"
dependencies = [
"libloading",
]
[[package]]
name = "ohos-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d380ab6c951261a0e44306245bc960b3b3367f099a7da7156bd1a3cacaf783c"
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "pico-args" name = "pico-args"
version = "0.5.0" version = "0.5.0"
@ -426,6 +542,53 @@ dependencies = [
"miniz_oxide 0.7.4", "miniz_oxide 0.7.4",
] ]
[[package]]
name = "proc-macro2"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]] [[package]]
name = "resvg" name = "resvg"
version = "0.42.0" version = "0.42.0"
@ -507,6 +670,17 @@ dependencies = [
"siphasher", "siphasher",
] ]
[[package]]
name = "syn"
version = "2.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]] [[package]]
name = "tiny-skia" name = "tiny-skia"
version = "0.11.4" version = "0.11.4"
@ -555,6 +729,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1"
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]] [[package]]
name = "unicode-linebreak" name = "unicode-linebreak"
version = "0.1.5" version = "0.1.5"

View file

@ -65,7 +65,6 @@ impl LiveRegister for App {
crate::editor::live_design(cx); crate::editor::live_design(cx);
crate::app_web::live_design(cx); crate::app_web::live_design(cx);
} }
// after_new_from_doc
} }
impl MatchEvent for App { impl MatchEvent for App {

View file

@ -56,7 +56,6 @@ impl Widget for AppWebUI {
} }
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep { fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
let editor_screen = self.ui.view(id!(patcheditorscreen)); let editor_screen = self.ui.view(id!(patcheditorscreen));
while let Some(_next) = self.ui.draw(cx, scope).step() { while let Some(_next) = self.ui.draw(cx, scope).step() {
editor_screen.draw_all(cx, scope); editor_screen.draw_all(cx, scope);
} }

View file

@ -78,7 +78,7 @@ impl Widget for FishPatchEditor {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) { fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
let uid = self.widget_uid(); let uid = self.widget_uid();
self.animator_handle_event(cx, event); self.animator_handle_event(cx, event);
self.scroll_bars.handle_event(cx, event); self.scroll_bars.handle_event(cx, event, scope);
for (_item_id, item) in self.items.values_mut() { for (_item_id, item) in self.items.values_mut() {
let _item_uid = item.widget_uid(); let _item_uid = item.widget_uid();