add offset / scrolling + clipboard support
This commit is contained in:
254
Cargo.lock
generated
254
Cargo.lock
generated
@@ -94,6 +94,27 @@ version = "1.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
|
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arboard"
|
||||||
|
version = "3.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf"
|
||||||
|
dependencies = [
|
||||||
|
"clipboard-win",
|
||||||
|
"image",
|
||||||
|
"log",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
"objc2-app-kit 0.3.1",
|
||||||
|
"objc2-core-foundation",
|
||||||
|
"objc2-core-graphics",
|
||||||
|
"objc2-foundation 0.3.1",
|
||||||
|
"parking_lot",
|
||||||
|
"percent-encoding",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
"wl-clipboard-rs",
|
||||||
|
"x11rb",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arg_enum_proc_macro"
|
name = "arg_enum_proc_macro"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
@@ -221,7 +242,7 @@ version = "0.5.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
|
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -339,6 +360,15 @@ version = "0.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clipboard-win"
|
||||||
|
version = "5.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4"
|
||||||
|
dependencies = [
|
||||||
|
"error-code",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "codespan-reporting"
|
name = "codespan-reporting"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
@@ -511,6 +541,16 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dispatch2"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dlib"
|
name = "dlib"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@@ -583,6 +623,12 @@ dependencies = [
|
|||||||
"windows-sys 0.60.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "error-code"
|
||||||
|
version = "3.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "exr"
|
name = "exr"
|
||||||
version = "1.73.0"
|
version = "1.73.0"
|
||||||
@@ -598,6 +644,12 @@ dependencies = [
|
|||||||
"zune-inflate",
|
"zune-inflate",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fdeflate"
|
name = "fdeflate"
|
||||||
version = "0.3.7"
|
version = "0.3.7"
|
||||||
@@ -607,6 +659,12 @@ dependencies = [
|
|||||||
"simd-adler32",
|
"simd-adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fixedbitset"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.1.2"
|
version = "1.1.2"
|
||||||
@@ -1322,6 +1380,15 @@ dependencies = [
|
|||||||
"objc2-encode",
|
"objc2-encode",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "561f357ba7f3a2a61563a186a163d0a3a5247e1089524a3981d49adb775078bc"
|
||||||
|
dependencies = [
|
||||||
|
"objc2-encode",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-app-kit"
|
name = "objc2-app-kit"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@@ -1331,13 +1398,25 @@ dependencies = [
|
|||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-core-data",
|
"objc2-core-data",
|
||||||
"objc2-core-image",
|
"objc2-core-image",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-app-kit"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
"objc2-core-graphics",
|
||||||
|
"objc2-foundation 0.3.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-cloud-kit"
|
name = "objc2-cloud-kit"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@@ -1346,9 +1425,9 @@ checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-core-location",
|
"objc2-core-location",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1358,8 +1437,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
|
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1370,8 +1449,32 @@ checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-core-foundation"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"dispatch2",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-core-graphics"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "989c6c68c13021b5c2d6b71456ebb0f9dc78d752e86a98da7c716f4f9470f5a4"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"dispatch2",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
"objc2-core-foundation",
|
||||||
|
"objc2-io-surface",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1381,8 +1484,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
|
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-metal",
|
"objc2-metal",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1393,9 +1496,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
|
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-contacts",
|
"objc2-contacts",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1414,7 +1517,29 @@ dependencies = [
|
|||||||
"block2",
|
"block2",
|
||||||
"dispatch",
|
"dispatch",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-foundation"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
"objc2-core-foundation",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-io-surface"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7282e9ac92529fa3457ce90ebb15f4ecbc383e8338060960760fa2cf75420c3c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.3",
|
||||||
|
"objc2 0.6.2",
|
||||||
|
"objc2-core-foundation",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1424,9 +1549,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
|
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.2.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1437,8 +1562,8 @@ checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1449,8 +1574,8 @@ checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-metal",
|
"objc2-metal",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1460,8 +1585,8 @@ version = "0.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
|
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1472,12 +1597,12 @@ checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-cloud-kit",
|
"objc2-cloud-kit",
|
||||||
"objc2-core-data",
|
"objc2-core-data",
|
||||||
"objc2-core-image",
|
"objc2-core-image",
|
||||||
"objc2-core-location",
|
"objc2-core-location",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-link-presentation",
|
"objc2-link-presentation",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core",
|
||||||
"objc2-symbols",
|
"objc2-symbols",
|
||||||
@@ -1492,8 +1617,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
|
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1504,9 +1629,9 @@ checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"block2",
|
"block2",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-core-location",
|
"objc2-core-location",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1533,6 +1658,16 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_pipe"
|
||||||
|
version = "1.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db335f4760b14ead6290116f2427bf33a14d4f0617d49f78a246de10c1831224"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "owned_ttf_parser"
|
name = "owned_ttf_parser"
|
||||||
version = "0.25.1"
|
version = "0.25.1"
|
||||||
@@ -1577,6 +1712,16 @@ version = "2.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "petgraph"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
|
||||||
|
dependencies = [
|
||||||
|
"fixedbitset",
|
||||||
|
"indexmap",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "1.1.10"
|
version = "1.1.10"
|
||||||
@@ -2193,6 +2338,19 @@ version = "0.12.16"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempfile"
|
||||||
|
version = "3.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
|
||||||
|
dependencies = [
|
||||||
|
"fastrand",
|
||||||
|
"getrandom 0.3.3",
|
||||||
|
"once_cell",
|
||||||
|
"rustix 1.0.8",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.4.1"
|
version = "1.4.1"
|
||||||
@@ -2343,6 +2501,18 @@ version = "0.1.34"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tree_magic_mini"
|
||||||
|
version = "3.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f943391d896cdfe8eec03a04d7110332d445be7df856db382dd96a730667562c"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"nom",
|
||||||
|
"once_cell",
|
||||||
|
"petgraph",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ttf-parser"
|
name = "ttf-parser"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
@@ -2365,6 +2535,7 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
|||||||
name = "ui"
|
name = "ui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"arboard",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cosmic-text",
|
"cosmic-text",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
@@ -3213,9 +3384,9 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"ndk",
|
"ndk",
|
||||||
"objc2",
|
"objc2 0.5.2",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.2.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit",
|
||||||
"orbclient",
|
"orbclient",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
@@ -3260,6 +3431,25 @@ dependencies = [
|
|||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wl-clipboard-rs"
|
||||||
|
version = "0.9.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"os_pipe",
|
||||||
|
"rustix 0.38.44",
|
||||||
|
"tempfile",
|
||||||
|
"thiserror 2.0.12",
|
||||||
|
"tree_magic_mini",
|
||||||
|
"wayland-backend",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-protocols",
|
||||||
|
"wayland-protocols-wlr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11-dl"
|
name = "x11-dl"
|
||||||
version = "2.21.0"
|
version = "2.21.0"
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ image = "0.25.6"
|
|||||||
cosmic-text = "0.14.2"
|
cosmic-text = "0.14.2"
|
||||||
unicode-segmentation = "1.12.0"
|
unicode-segmentation = "1.12.0"
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
|
arboard = { version = "3.6.1", features = ["wayland-data-control"] }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
mod align;
|
mod align;
|
||||||
mod image;
|
mod image;
|
||||||
|
mod offset;
|
||||||
mod pad;
|
mod pad;
|
||||||
mod rect;
|
mod rect;
|
||||||
|
mod scroll;
|
||||||
mod sense;
|
mod sense;
|
||||||
mod sized;
|
mod sized;
|
||||||
mod span;
|
mod span;
|
||||||
@@ -12,8 +14,10 @@ mod trait_fns;
|
|||||||
|
|
||||||
pub use align::*;
|
pub use align::*;
|
||||||
pub use image::*;
|
pub use image::*;
|
||||||
|
pub use offset::*;
|
||||||
pub use pad::*;
|
pub use pad::*;
|
||||||
pub use rect::*;
|
pub use rect::*;
|
||||||
|
pub use scroll::*;
|
||||||
pub use sense::*;
|
pub use sense::*;
|
||||||
pub use sized::*;
|
pub use sized::*;
|
||||||
pub use span::*;
|
pub use span::*;
|
||||||
|
|||||||
17
src/core/offset.rs
Normal file
17
src/core/offset.rs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
pub struct Offset {
|
||||||
|
pub inner: WidgetId,
|
||||||
|
pub amt: UiVec2,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Widget for Offset {
|
||||||
|
fn draw(&mut self, painter: &mut Painter) {
|
||||||
|
let region = UiRegion::full().offset(self.amt);
|
||||||
|
painter.widget_within(&self.inner, region);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn desired_size(&mut self, ctx: &mut SizeCtx) -> UiVec2 {
|
||||||
|
ctx.size(&self.inner)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,10 +31,10 @@ impl Widget for Padded {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct Padding {
|
pub struct Padding {
|
||||||
left: f32,
|
pub left: f32,
|
||||||
right: f32,
|
pub right: f32,
|
||||||
top: f32,
|
pub top: f32,
|
||||||
bottom: f32,
|
pub bottom: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Padding {
|
impl Padding {
|
||||||
|
|||||||
19
src/core/scroll.rs
Normal file
19
src/core/scroll.rs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
pub struct Scroll {
|
||||||
|
pub inner: Offset,
|
||||||
|
pub size: UiVec2,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Widget for Scroll {
|
||||||
|
fn draw(&mut self, painter: &mut Painter) {
|
||||||
|
self.inner.draw(painter);
|
||||||
|
}
|
||||||
|
fn desired_size(&mut self, _: &mut SizeCtx) -> UiVec2 {
|
||||||
|
self.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ScrollModule {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ pub enum Sense {
|
|||||||
HoverStart,
|
HoverStart,
|
||||||
Hovering,
|
Hovering,
|
||||||
HoverEnd,
|
HoverEnd,
|
||||||
|
Scroll,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Senses(Vec<Sense>);
|
pub struct Senses(Vec<Sense>);
|
||||||
@@ -47,6 +48,7 @@ pub struct CursorState {
|
|||||||
pub pos: Vec2,
|
pub pos: Vec2,
|
||||||
pub exists: bool,
|
pub exists: bool,
|
||||||
pub buttons: CursorButtons,
|
pub buttons: CursorButtons,
|
||||||
|
pub scroll_delta: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
@@ -72,6 +74,13 @@ impl CursorButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CursorState {
|
||||||
|
pub fn end_frame(&mut self) {
|
||||||
|
self.buttons.end_frame();
|
||||||
|
self.scroll_delta = Vec2::ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Default, PartialEq)]
|
#[derive(Debug, Clone, Copy, Default, PartialEq)]
|
||||||
pub enum ActivationState {
|
pub enum ActivationState {
|
||||||
Start,
|
Start,
|
||||||
@@ -81,29 +90,27 @@ pub enum ActivationState {
|
|||||||
Off,
|
Off,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Sensor<Ctx> {
|
pub struct Sensor<Ctx, Data> {
|
||||||
pub senses: Senses,
|
pub senses: Senses,
|
||||||
pub f: Rc<dyn SenseFn<Ctx>>,
|
pub f: Rc<dyn EventFn<Ctx, Data>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SensorMap<Ctx> = HashMap<Id, SensorGroup<Ctx>>;
|
pub type SensorMap<Ctx, Data> = HashMap<Id, SensorGroup<Ctx, Data>>;
|
||||||
pub type SenseShape = UiRegion;
|
pub type SenseShape = UiRegion;
|
||||||
pub struct SensorGroup<Ctx> {
|
pub struct SensorGroup<Ctx, Data> {
|
||||||
pub hover: ActivationState,
|
pub hover: ActivationState,
|
||||||
pub sensors: Vec<Sensor<Ctx>>,
|
pub sensors: Vec<Sensor<Ctx, Data>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SenseData {
|
pub struct CursorData {
|
||||||
pub cursor: Vec2,
|
pub cursor: Vec2,
|
||||||
pub size: Vec2,
|
pub size: Vec2,
|
||||||
|
pub scroll_delta: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait SenseFn<Ctx>: Fn(&mut Ctx, SenseData) + 'static {}
|
|
||||||
impl<F: Fn(&mut Ctx, SenseData) + 'static, Ctx> SenseFn<Ctx> for F {}
|
|
||||||
|
|
||||||
pub struct SensorModule<Ctx> {
|
pub struct SensorModule<Ctx> {
|
||||||
map: SensorMap<Ctx>,
|
map: SensorMap<Ctx, CursorData>,
|
||||||
active: HashMap<usize, HashMap<Id, SenseShape>>,
|
active: HashMap<usize, HashMap<Id, SenseShape>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +132,9 @@ impl<Ctx: 'static> UiModule for SensorModule<Ctx> {
|
|||||||
|
|
||||||
fn on_remove(&mut self, id: &Id) {
|
fn on_remove(&mut self, id: &Id) {
|
||||||
self.map.remove(id);
|
self.map.remove(id);
|
||||||
|
for layer in self.active.values_mut() {
|
||||||
|
layer.remove(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_move(&mut self, inst: &WidgetInstance) {
|
fn on_move(&mut self, inst: &WidgetInstance) {
|
||||||
@@ -165,7 +175,7 @@ impl<Ctx: UiCtx + 'static> SensorModule<Ctx> {
|
|||||||
let Some(list) = module.active.get_mut(&i) else {
|
let Some(list) = module.active.get_mut(&i) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let mut ran = false;
|
let mut sensed = false;
|
||||||
for (id, shape) in list.iter() {
|
for (id, shape) in list.iter() {
|
||||||
let group = module.map.get_mut(id).unwrap();
|
let group = module.map.get_mut(id).unwrap();
|
||||||
let region = shape.to_screen(window_size);
|
let region = shape.to_screen(window_size);
|
||||||
@@ -174,19 +184,20 @@ impl<Ctx: UiCtx + 'static> SensorModule<Ctx> {
|
|||||||
if group.hover == ActivationState::Off {
|
if group.hover == ActivationState::Off {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
sensed = true;
|
||||||
|
|
||||||
for sensor in &mut group.sensors {
|
for sensor in &mut group.sensors {
|
||||||
if should_run(&sensor.senses, &cursor.buttons, group.hover) {
|
if should_run(&sensor.senses, cursor, group.hover) {
|
||||||
ran = true;
|
let data = CursorData {
|
||||||
let sctx = SenseData {
|
|
||||||
cursor: cursor.pos - region.top_left,
|
cursor: cursor.pos - region.top_left,
|
||||||
size: region.bot_right - region.top_left,
|
size: region.bot_right - region.top_left,
|
||||||
|
scroll_delta: cursor.scroll_delta,
|
||||||
};
|
};
|
||||||
(sensor.f)(ctx, sctx);
|
(sensor.f)(ctx, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ran {
|
if sensed {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,15 +209,16 @@ impl<Ctx: UiCtx + 'static> SensorModule<Ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_run(senses: &Senses, cursor: &CursorButtons, hover: ActivationState) -> bool {
|
pub fn should_run(senses: &Senses, cursor: &CursorState, hover: ActivationState) -> bool {
|
||||||
for sense in senses.iter() {
|
for sense in senses.iter() {
|
||||||
if match sense {
|
if match sense {
|
||||||
Sense::PressStart(button) => cursor.select(button).is_start(),
|
Sense::PressStart(button) => cursor.buttons.select(button).is_start(),
|
||||||
Sense::Pressing(button) => cursor.select(button).is_on(),
|
Sense::Pressing(button) => cursor.buttons.select(button).is_on(),
|
||||||
Sense::PressEnd(button) => cursor.select(button).is_end(),
|
Sense::PressEnd(button) => cursor.buttons.select(button).is_end(),
|
||||||
Sense::HoverStart => hover.is_start(),
|
Sense::HoverStart => hover.is_start(),
|
||||||
Sense::Hovering => hover.is_on(),
|
Sense::Hovering => hover.is_on(),
|
||||||
Sense::HoverEnd => hover.is_end(),
|
Sense::HoverEnd => hover.is_end(),
|
||||||
|
Sense::Scroll => cursor.scroll_delta != Vec2::ZERO,
|
||||||
} {
|
} {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -259,12 +271,12 @@ impl ActivationState {
|
|||||||
|
|
||||||
impl Event for Senses {
|
impl Event for Senses {
|
||||||
type Module<Ctx: 'static> = SensorModule<Ctx>;
|
type Module<Ctx: 'static> = SensorModule<Ctx>;
|
||||||
type Data = SenseData;
|
type Data = CursorData;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event for Sense {
|
impl Event for Sense {
|
||||||
type Module<Ctx: 'static> = SensorModule<Ctx>;
|
type Module<Ctx: 'static> = SensorModule<Ctx>;
|
||||||
type Data = SenseData;
|
type Data = CursorData;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: Event<Data = <Senses as Event>::Data> + Into<Senses>, Ctx: 'static> EventModule<E, Ctx>
|
impl<E: Event<Data = <Senses as Event>::Data> + Into<Senses>, Ctx: 'static> EventModule<E, Ctx>
|
||||||
@@ -292,7 +304,7 @@ impl<E: Event<Data = <Senses as Event>::Data> + Into<Senses>, Ctx: 'static> Even
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
Some(move |ctx: &mut Ctx, data: SenseData| {
|
Some(move |ctx: &mut Ctx, data: CursorData| {
|
||||||
for f in &fs {
|
for f in &fs {
|
||||||
f(ctx, data.clone());
|
f(ctx, data.clone());
|
||||||
}
|
}
|
||||||
@@ -303,7 +315,7 @@ impl<E: Event<Data = <Senses as Event>::Data> + Into<Senses>, Ctx: 'static> Even
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Ctx> Default for SensorGroup<Ctx> {
|
impl<Ctx, Data> Default for SensorGroup<Ctx, Data> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
hover: Default::default(),
|
hover: Default::default(),
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ impl Widget for TextEdit {
|
|||||||
painter.primitive_within(
|
painter.primitive_within(
|
||||||
RectPrimitive::color(Color::WHITE),
|
RectPrimitive::color(Color::WHITE),
|
||||||
UiRegion::from_size_align(size, Align::TopLeft)
|
UiRegion::from_size_align(size, Align::TopLeft)
|
||||||
.shifted(offset)
|
.offset(offset)
|
||||||
.within(®ion),
|
.within(®ion),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -247,7 +247,13 @@ impl<'a> TextEditCtx<'a> {
|
|||||||
}
|
}
|
||||||
_ => return TextInputResult::Unused,
|
_ => return TextInputResult::Unused,
|
||||||
},
|
},
|
||||||
Key::Character(text) => self.insert(text),
|
Key::Character(text) => {
|
||||||
|
if modifiers.control && text == "v" {
|
||||||
|
return TextInputResult::Paste;
|
||||||
|
} else {
|
||||||
|
self.insert(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => return TextInputResult::Unused,
|
_ => return TextInputResult::Unused,
|
||||||
}
|
}
|
||||||
TextInputResult::Used
|
TextInputResult::Used
|
||||||
@@ -272,6 +278,7 @@ pub enum TextInputResult {
|
|||||||
Unused,
|
Unused,
|
||||||
Unfocus,
|
Unfocus,
|
||||||
Submit,
|
Submit,
|
||||||
|
Paste,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextInputResult {
|
impl TextInputResult {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ pub trait CoreWidget<W, Tag> {
|
|||||||
fn center(self) -> impl WidgetFn<Aligned>;
|
fn center(self) -> impl WidgetFn<Aligned>;
|
||||||
fn label(self, label: impl Into<String>) -> impl WidgetIdFn<W>;
|
fn label(self, label: impl Into<String>) -> impl WidgetIdFn<W>;
|
||||||
fn sized(self, size: impl Into<Vec2>) -> impl WidgetFn<Sized>;
|
fn sized(self, size: impl Into<Vec2>) -> impl WidgetFn<Sized>;
|
||||||
|
fn offset(self, amt: impl Into<UiVec2>) -> impl WidgetFn<Offset>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: WidgetLike<Tag>, Tag> CoreWidget<W::Widget, Tag> for W {
|
impl<W: WidgetLike<Tag>, Tag> CoreWidget<W::Widget, Tag> for W {
|
||||||
@@ -42,6 +43,13 @@ impl<W: WidgetLike<Tag>, Tag> CoreWidget<W::Widget, Tag> for W {
|
|||||||
size: size.into(),
|
size: size.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn offset(self, amt: impl Into<UiVec2>) -> impl WidgetFn<Offset> {
|
||||||
|
move |ui| Offset {
|
||||||
|
inner: self.add(ui).any(),
|
||||||
|
amt: amt.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CoreWidgetArr<const LEN: usize, Wa: WidgetArrLike<LEN, Tag>, Tag> {
|
pub trait CoreWidgetArr<const LEN: usize, Wa: WidgetArrLike<LEN, Tag>, Tag> {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ pub enum Align {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Align {
|
impl Align {
|
||||||
pub const fn anchor(&self) -> Vec2 {
|
pub const fn rel(&self) -> Vec2 {
|
||||||
match self {
|
match self {
|
||||||
Self::TopLeft => vec2(0.0, 0.0),
|
Self::TopLeft => vec2(0.0, 0.0),
|
||||||
Self::Top => vec2(0.5, 0.0),
|
Self::Top => vec2(0.5, 0.0),
|
||||||
|
|||||||
@@ -131,7 +131,9 @@ impl<'a> PainterCtx<'a> {
|
|||||||
if active.region == region {
|
if active.region == region {
|
||||||
return;
|
return;
|
||||||
} else if active.region.size() == region.size() {
|
} else if active.region.size() == region.size() {
|
||||||
self.mov(id, region);
|
// TODO: epsilon?
|
||||||
|
let from = active.region;
|
||||||
|
self.mov(id, from, region);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let active = self.remove(id).unwrap();
|
let active = self.remove(id).unwrap();
|
||||||
@@ -185,22 +187,21 @@ impl<'a> PainterCtx<'a> {
|
|||||||
self.active.insert(id, instance);
|
self.active.insert(id, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mov(&mut self, id: Id, to: UiRegion) {
|
fn mov(&mut self, id: Id, from: UiRegion, to: UiRegion) {
|
||||||
let active = self.active.get_mut(&id).unwrap();
|
let active = self.active.get_mut(&id).unwrap();
|
||||||
// children will not be changed, so this technically should not be needed
|
// children will not be changed, so this technically should not be needed
|
||||||
// probably need unsafe
|
// probably need unsafe
|
||||||
let from = active.region;
|
|
||||||
for h in &active.primitives {
|
for h in &active.primitives {
|
||||||
let region = self.layers[h.layer].primitives.region_mut(h);
|
let region = self.layers[h.layer].primitives.region_mut(h);
|
||||||
*region = region.outside(&from).within(&to);
|
*region = region.outside(&from).within(&to);
|
||||||
}
|
}
|
||||||
active.region = to;
|
active.region = active.region.outside(&from).within(&to);
|
||||||
for m in self.modules.iter_mut() {
|
for m in self.modules.iter_mut() {
|
||||||
m.on_move(active);
|
m.on_move(active);
|
||||||
}
|
}
|
||||||
let children = active.children.clone();
|
let children = active.children.clone();
|
||||||
for child in children {
|
for child in children {
|
||||||
self.mov(child, to);
|
self.mov(child, from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,23 +11,20 @@ pub struct UiVec2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UiVec2 {
|
impl UiVec2 {
|
||||||
|
pub const ZERO: Self = Self {
|
||||||
|
rel: Vec2::ZERO,
|
||||||
|
abs: Vec2::ZERO,
|
||||||
|
};
|
||||||
|
|
||||||
/// expands this position into a sized region centered at self
|
/// expands this position into a sized region centered at self
|
||||||
pub fn expand(&self, size: impl Into<Vec2>) -> UiRegion {
|
pub fn expand(&self, size: impl Into<Vec2>) -> UiRegion {
|
||||||
let size = size.into();
|
let size = size.into();
|
||||||
UiRegion {
|
UiRegion {
|
||||||
top_left: self.shifted(-size / 2.0),
|
top_left: self.offset(-size / 2.0),
|
||||||
bot_right: self.shifted(size / 2.0),
|
bot_right: self.offset(size / 2.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn anchor(anchor: Vec2) -> Self {
|
|
||||||
Self::rel(anchor)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const fn offset(offset: Vec2) -> Self {
|
|
||||||
Self::abs(offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const fn abs(abs: Vec2) -> Self {
|
pub const fn abs(abs: Vec2) -> Self {
|
||||||
Self {
|
Self {
|
||||||
rel: Vec2::ZERO,
|
rel: Vec2::ZERO,
|
||||||
@@ -42,11 +39,12 @@ impl UiVec2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn shift(&mut self, offset: impl const Into<Vec2>) {
|
pub const fn shift(&mut self, offset: impl const Into<UiVec2>) {
|
||||||
self.abs += offset.into();
|
let offset = offset.into();
|
||||||
|
*self += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn shifted(mut self, offset: Vec2) -> Self {
|
pub const fn offset(mut self, offset: impl const Into<UiVec2>) -> Self {
|
||||||
self.shift(offset);
|
self.shift(offset);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@@ -118,7 +116,7 @@ impl_op!(UiVec2 Sub sub; rel abs);
|
|||||||
|
|
||||||
impl const From<Align> for UiVec2 {
|
impl const From<Align> for UiVec2 {
|
||||||
fn from(align: Align) -> Self {
|
fn from(align: Align) -> Self {
|
||||||
Self::anchor(align.anchor())
|
Self::rel(align.rel())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +126,12 @@ impl Align {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl const From<Vec2> for UiVec2 {
|
||||||
|
fn from(abs: Vec2) -> Self {
|
||||||
|
Self::abs(abs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub struct UiScalar {
|
pub struct UiScalar {
|
||||||
pub rel: f32,
|
pub rel: f32,
|
||||||
@@ -198,10 +202,10 @@ impl UiRegion {
|
|||||||
bot_right: Align::BotRight.into(),
|
bot_right: Align::BotRight.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn anchor(anchor: Vec2) -> Self {
|
pub fn rel(anchor: Vec2) -> Self {
|
||||||
Self {
|
Self {
|
||||||
top_left: UiVec2::anchor(anchor),
|
top_left: UiVec2::rel(anchor),
|
||||||
bot_right: UiVec2::anchor(anchor),
|
bot_right: UiVec2::rel(anchor),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn within(&self, parent: &Self) -> Self {
|
pub fn within(&self, parent: &Self) -> Self {
|
||||||
@@ -229,13 +233,13 @@ impl UiRegion {
|
|||||||
std::mem::swap(&mut self.top_left, &mut self.bot_right);
|
std::mem::swap(&mut self.top_left, &mut self.bot_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn shift(&mut self, offset: impl Into<Vec2>) {
|
pub fn shift(&mut self, offset: impl Into<UiVec2>) {
|
||||||
let offset = offset.into();
|
let offset = offset.into();
|
||||||
self.top_left.shift(offset);
|
self.top_left.shift(offset);
|
||||||
self.bot_right.shift(offset);
|
self.bot_right.shift(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn shifted(mut self, offset: impl Into<Vec2>) -> Self {
|
pub fn offset(mut self, offset: impl Into<UiVec2>) -> Self {
|
||||||
self.shift(offset);
|
self.shift(offset);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@@ -265,9 +269,9 @@ impl UiRegion {
|
|||||||
|
|
||||||
pub fn from_size_align(size: Vec2, align: Align) -> Self {
|
pub fn from_size_align(size: Vec2, align: Align) -> Self {
|
||||||
let mut top_left = UiVec2::from(align);
|
let mut top_left = UiVec2::from(align);
|
||||||
top_left.abs -= size * align.anchor();
|
top_left.abs -= size * align.rel();
|
||||||
let mut bot_right = UiVec2::from(align);
|
let mut bot_right = UiVec2::from(align);
|
||||||
bot_right.abs += size * (Vec2::ONE - align.anchor());
|
bot_right.abs += size * (Vec2::ONE - align.rel());
|
||||||
Self {
|
Self {
|
||||||
top_left,
|
top_left,
|
||||||
bot_right,
|
bot_right,
|
||||||
@@ -276,11 +280,11 @@ impl UiRegion {
|
|||||||
|
|
||||||
pub fn from_ui_size_align(size: UiVec2, align: Align) -> Self {
|
pub fn from_ui_size_align(size: UiVec2, align: Align) -> Self {
|
||||||
let mut top_left = UiVec2::from(align);
|
let mut top_left = UiVec2::from(align);
|
||||||
top_left.abs -= size.abs * align.anchor();
|
top_left.abs -= size.abs * align.rel();
|
||||||
top_left.rel -= size.rel * align.anchor();
|
top_left.rel -= size.rel * align.rel();
|
||||||
let mut bot_right = UiVec2::from(align);
|
let mut bot_right = UiVec2::from(align);
|
||||||
bot_right.abs += size.abs * (Vec2::ONE - align.anchor());
|
bot_right.abs += size.abs * (Vec2::ONE - align.rel());
|
||||||
bot_right.rel += size.rel * (Vec2::ONE - align.anchor());
|
bot_right.rel += size.rel * (Vec2::ONE - align.rel());
|
||||||
Self {
|
Self {
|
||||||
top_left,
|
top_left,
|
||||||
bot_right,
|
bot_right,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_convert)]
|
#![feature(const_convert)]
|
||||||
#![feature(map_try_insert)]
|
#![feature(map_try_insert)]
|
||||||
#![feature(trait_alias)]
|
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(fn_traits)]
|
#![feature(fn_traits)]
|
||||||
#![feature(const_cmp)]
|
#![feature(const_cmp)]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use ui::{
|
|||||||
layout::Vec2,
|
layout::Vec2,
|
||||||
};
|
};
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{MouseButton, WindowEvent},
|
event::{MouseButton, MouseScrollDelta, WindowEvent},
|
||||||
keyboard::{Key, NamedKey},
|
keyboard::{Key, NamedKey},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,6 +32,13 @@ impl Input {
|
|||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WindowEvent::MouseWheel { delta, .. } => {
|
||||||
|
let delta = match *delta {
|
||||||
|
MouseScrollDelta::LineDelta(x, y) => Vec2::new(x, y),
|
||||||
|
MouseScrollDelta::PixelDelta(pos) => Vec2::new(pos.x as f32, pos.y as f32),
|
||||||
|
};
|
||||||
|
self.cursor.scroll_delta = delta;
|
||||||
|
}
|
||||||
WindowEvent::CursorLeft { .. } => {
|
WindowEvent::CursorLeft { .. } => {
|
||||||
self.cursor.exists = false;
|
self.cursor.exists = false;
|
||||||
self.modifiers.clear();
|
self.modifiers.clear();
|
||||||
@@ -56,7 +63,7 @@ impl Input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn end_frame(&mut self) {
|
pub fn end_frame(&mut self) {
|
||||||
self.cursor.buttons.end_frame();
|
self.cursor.end_frame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use app::App;
|
use app::App;
|
||||||
|
use arboard::Clipboard;
|
||||||
use cosmic_text::Family;
|
use cosmic_text::Family;
|
||||||
use render::Renderer;
|
use render::Renderer;
|
||||||
use ui::prelude::*;
|
use ui::prelude::*;
|
||||||
@@ -22,6 +23,7 @@ pub struct Client {
|
|||||||
ui: Ui,
|
ui: Ui,
|
||||||
info: WidgetId<Text>,
|
info: WidgetId<Text>,
|
||||||
focus: Option<WidgetId<TextEdit>>,
|
focus: Option<WidgetId<TextEdit>>,
|
||||||
|
clipboard: Clipboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Hash, Clone)]
|
#[derive(Eq, PartialEq, Hash, Clone)]
|
||||||
@@ -127,6 +129,15 @@ impl Client {
|
|||||||
.add_static(&mut ui);
|
.add_static(&mut ui);
|
||||||
|
|
||||||
let texts = Span::empty(Dir::DOWN).add_static(&mut ui);
|
let texts = Span::empty(Dir::DOWN).add_static(&mut ui);
|
||||||
|
let msg_area = (
|
||||||
|
Rect::new(Color::SKY),
|
||||||
|
texts
|
||||||
|
.offset(UiVec2::ZERO)
|
||||||
|
.edit_on(Sense::Scroll, |w, data| {
|
||||||
|
w.amt += UiVec2::abs(data.scroll_delta * 50.0);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.stack();
|
||||||
let add_text = text_edit("add")
|
let add_text = text_edit("add")
|
||||||
.text_align(Align::Left)
|
.text_align(Align::Left)
|
||||||
.size(30)
|
.size(30)
|
||||||
@@ -151,7 +162,7 @@ impl Client {
|
|||||||
})
|
})
|
||||||
.add(&mut ui);
|
.add(&mut ui);
|
||||||
let text_edit_scroll = (
|
let text_edit_scroll = (
|
||||||
(Rect::new(Color::SKY), texts).stack(),
|
msg_area,
|
||||||
(
|
(
|
||||||
Rect::new(Color::WHITE.darker(0.9)),
|
Rect::new(Color::WHITE.darker(0.9)),
|
||||||
(
|
(
|
||||||
@@ -217,6 +228,7 @@ impl Client {
|
|||||||
ui,
|
ui,
|
||||||
info,
|
info,
|
||||||
focus: None,
|
focus: None,
|
||||||
|
clipboard: Clipboard::new().unwrap(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,14 +261,20 @@ impl Client {
|
|||||||
if let Some(sel) = &self.focus
|
if let Some(sel) = &self.focus
|
||||||
&& event.state.is_pressed()
|
&& event.state.is_pressed()
|
||||||
{
|
{
|
||||||
match self.ui.text(sel).apply_event(&event, &self.input.modifiers) {
|
let mut text = self.ui.text(sel);
|
||||||
|
match text.apply_event(&event, &self.input.modifiers) {
|
||||||
TextInputResult::Unfocus => {
|
TextInputResult::Unfocus => {
|
||||||
self.focus = None;
|
self.focus = None;
|
||||||
}
|
}
|
||||||
TextInputResult::Submit => {
|
TextInputResult::Submit => {
|
||||||
self.run_event(&sel.clone(), Submit, ());
|
self.run_event(&sel.clone(), Submit, ());
|
||||||
}
|
}
|
||||||
_ => (),
|
TextInputResult::Paste => {
|
||||||
|
if let Ok(t) = self.clipboard.get_text() {
|
||||||
|
text.insert(&t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextInputResult::Unused | TextInputResult::Used => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user