Update the Vizia fork
This commit is contained in:
parent
00fff75c5e
commit
f646ffcfb5
93
Cargo.lock
generated
93
Cargo.lock
generated
|
@ -47,15 +47,6 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aliasable"
|
||||
version = "0.1.3"
|
||||
|
@ -718,6 +709,16 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cstr_core"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "644828c273c063ab0d39486ba42a5d1f3a499d35529c759e763a9c6cb8a0fb08"
|
||||
dependencies = [
|
||||
"cty",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.22"
|
||||
|
@ -1317,9 +1318,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e"
|
||||
checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1772,9 +1773,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.122"
|
||||
version = "0.2.124"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259"
|
||||
checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
@ -1792,19 +1793,6 @@ version = "0.5.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
|
||||
[[package]]
|
||||
name = "locale_config"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d2c35b16f4483f6c26f0e4e9550717a2f6575bcd6f12a53ff0c490a94a6934"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"regex",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.7"
|
||||
|
@ -2694,9 +2682,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.1"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
|
||||
checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"crossbeam-deque",
|
||||
|
@ -2706,14 +2694,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.9.1"
|
||||
version = "1.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
|
||||
checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
|
@ -2761,23 +2748,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "renderdoc-sys"
|
||||
version = "0.7.1"
|
||||
|
@ -3210,6 +3180,19 @@ dependencies = [
|
|||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sys-locale"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3913c5a3d30054d7f77cf07cdd800c8103ace15c6e44437c5db66a43dd3a92cf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cstr_core",
|
||||
"libc",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
|
@ -3271,9 +3254,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.8"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -3462,7 +3445,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||
[[package]]
|
||||
name = "vizia"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#c52aad2d80018965266e145d2e125721ed7c9219"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#3e8238ef97f5e355259131aef0632656209bc1bd"
|
||||
dependencies = [
|
||||
"vizia_baseview",
|
||||
"vizia_core",
|
||||
|
@ -3471,7 +3454,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "vizia_baseview"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#c52aad2d80018965266e145d2e125721ed7c9219"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#3e8238ef97f5e355259131aef0632656209bc1bd"
|
||||
dependencies = [
|
||||
"baseview 0.1.0 (git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize)",
|
||||
"femtovg",
|
||||
|
@ -3483,7 +3466,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "vizia_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#c52aad2d80018965266e145d2e125721ed7c9219"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#3e8238ef97f5e355259131aef0632656209bc1bd"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"copypasta",
|
||||
|
@ -3496,8 +3479,8 @@ dependencies = [
|
|||
"image 0.24.1",
|
||||
"instant",
|
||||
"keyboard-types",
|
||||
"locale_config",
|
||||
"morphorm",
|
||||
"sys-locale",
|
||||
"unic-langid",
|
||||
"unicode-bidi",
|
||||
"unicode-segmentation",
|
||||
|
@ -3508,7 +3491,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "vizia_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#c52aad2d80018965266e145d2e125721ed7c9219"
|
||||
source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#3e8238ef97f5e355259131aef0632656209bc1bd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -143,44 +143,28 @@ where
|
|||
L: Lens<Target = f32>,
|
||||
P: Lens<Target = f32>,
|
||||
{
|
||||
fn draw(&self, cx: &mut Context, canvas: &mut Canvas) {
|
||||
fn draw(&self, cx: &mut DrawContext, canvas: &mut Canvas) {
|
||||
let level_dbfs = self.level_dbfs.get(cx);
|
||||
let peak_dbfs = self.peak_dbfs.get(cx);
|
||||
|
||||
// These basics are taken directly from the default implementation of this function
|
||||
let entity = cx.current;
|
||||
let bounds = cx.cache.get_bounds(entity);
|
||||
let entity = cx.current();
|
||||
let bounds = cx.cache().get_bounds(entity);
|
||||
if bounds.w == 0.0 || bounds.h == 0.0 {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: It would be cool to allow the text color property to control the gradient here. For
|
||||
// now we'll only support basic background colors and borders.
|
||||
let background_color = cx
|
||||
.style
|
||||
.background_color
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
let border_color = cx
|
||||
.style
|
||||
.border_color
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
let opacity = cx.cache.get_opacity(entity);
|
||||
let background_color = cx.background_color(entity).cloned().unwrap_or_default();
|
||||
let border_color = cx.border_color(entity).cloned().unwrap_or_default();
|
||||
let opacity = cx.cache().get_opacity(entity);
|
||||
let mut background_color: vg::Color = background_color.into();
|
||||
background_color.set_alphaf(background_color.a * opacity);
|
||||
let mut border_color: vg::Color = border_color.into();
|
||||
border_color.set_alphaf(border_color.a * opacity);
|
||||
|
||||
let border_width = match cx
|
||||
.style
|
||||
.border_width
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
{
|
||||
let border_width = match cx.border_width(entity).unwrap_or_default() {
|
||||
Units::Pixels(val) => val,
|
||||
Units::Percentage(val) => bounds.w.min(bounds.h) * (val / 100.0),
|
||||
_ => 0.0,
|
||||
|
@ -212,7 +196,7 @@ where
|
|||
|
||||
// NOTE: We'll scale this with the nearest integer DPI ratio. That way it will still look
|
||||
// good at 2x scaling, and it won't look blurry at 1.x times scaling.
|
||||
let dpi_scale = cx.style.dpi_factor.floor().max(1.0) as f32;
|
||||
let dpi_scale = cx.logical_to_physical(1.0).floor().max(1.0) as f32;
|
||||
let bar_tick_coordinates = (bar_ticks_start_x..bar_ticks_end_x)
|
||||
.step_by(((TICK_WIDTH + TICK_GAP) * dpi_scale).round() as usize);
|
||||
for tick_x in bar_tick_coordinates {
|
||||
|
|
|
@ -101,41 +101,25 @@ impl View for ResizeHandle {
|
|||
}
|
||||
}
|
||||
|
||||
fn draw(&self, cx: &mut Context, canvas: &mut Canvas) {
|
||||
fn draw(&self, cx: &mut DrawContext, canvas: &mut Canvas) {
|
||||
// We'll draw the handle directly as styling elements for this is going to be a bit tricky
|
||||
|
||||
// These basics are taken directly from the default implementation of this function
|
||||
let entity = cx.current;
|
||||
let bounds = cx.cache.get_bounds(entity);
|
||||
let entity = cx.current();
|
||||
let bounds = cx.cache().get_bounds(entity);
|
||||
if bounds.w == 0.0 || bounds.h == 0.0 {
|
||||
return;
|
||||
}
|
||||
|
||||
let background_color = cx
|
||||
.style
|
||||
.background_color
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
let border_color = cx
|
||||
.style
|
||||
.border_color
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
let opacity = cx.cache.get_opacity(entity);
|
||||
let background_color = cx.background_color(entity).copied().unwrap_or_default();
|
||||
let border_color = cx.border_color(entity).copied().unwrap_or_default();
|
||||
let opacity = cx.cache().get_opacity(entity);
|
||||
let mut background_color: vg::Color = background_color.into();
|
||||
background_color.set_alphaf(background_color.a * opacity);
|
||||
let mut border_color: vg::Color = border_color.into();
|
||||
border_color.set_alphaf(border_color.a * opacity);
|
||||
|
||||
let border_width = match cx
|
||||
.style
|
||||
.border_width
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
{
|
||||
let border_width = match cx.border_width(entity).unwrap_or_default() {
|
||||
Units::Pixels(val) => val,
|
||||
Units::Percentage(val) => bounds.w.min(bounds.h) * (val / 100.0),
|
||||
_ => 0.0,
|
||||
|
@ -191,10 +175,8 @@ impl View for ResizeHandle {
|
|||
// path.close();
|
||||
|
||||
let mut color: vg::Color = cx
|
||||
.style
|
||||
.font_color
|
||||
.get(entity)
|
||||
.cloned()
|
||||
.font_color(entity)
|
||||
.copied()
|
||||
.unwrap_or(Color::white())
|
||||
.into();
|
||||
color.set_alphaf(color.a * opacity);
|
||||
|
|
Loading…
Reference in a new issue