Fix graph view button hotkey tooltip; fix layer CSS bug

This commit is contained in:
Keavon Chambers
2023-08-19 17:04:09 -07:00
parent a566331f1c
commit 980b692d46
3 changed files with 267 additions and 257 deletions
@@ -46,13 +46,14 @@ impl InputMapperMessageHandler {
} }
pub fn action_input_mapping(&self, action_to_find: &MessageDiscriminant) -> Vec<KeysGroup> { pub fn action_input_mapping(&self, action_to_find: &MessageDiscriminant) -> Vec<KeysGroup> {
let key_up = self.mapping.key_up.iter(); let all_key_mapping_entries = std::iter::empty()
let key_down = self.mapping.key_down.iter(); .chain(self.mapping.key_up.iter())
let double_click = std::iter::once(&self.mapping.double_click); .chain(self.mapping.key_down.iter())
let wheel_scroll = std::iter::once(&self.mapping.wheel_scroll); .chain(self.mapping.key_up_no_repeat.iter())
let pointer_move = std::iter::once(&self.mapping.pointer_move); .chain(self.mapping.key_down_no_repeat.iter())
.chain(std::iter::once(&self.mapping.double_click))
let all_key_mapping_entries = key_up.chain(key_down).chain(double_click).chain(wheel_scroll).chain(pointer_move); .chain(std::iter::once(&self.mapping.wheel_scroll))
.chain(std::iter::once(&self.mapping.pointer_move));
let all_mapping_entries = all_key_mapping_entries.flat_map(|entry| entry.0.iter()); let all_mapping_entries = all_key_mapping_entries.flat_map(|entry| entry.0.iter());
// Filter for the desired message // Filter for the desired message
@@ -69,15 +70,18 @@ impl InputMapperMessageHandler {
// TODO: Use a safe solution eventually // TODO: Use a safe solution eventually
assert!( assert!(
i < input_keyboard::NUMBER_OF_KEYS, i < input_keyboard::NUMBER_OF_KEYS,
"Attempting to convert a Key with enum index {}, which is larger than the number of Key enums", "Attempting to convert a Key with enum index {i}, which is larger than the number of Key enums",
i
); );
(i as u8).try_into().unwrap() (i as u8).try_into().unwrap()
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if let InputMapperMessage::KeyDown(key) = entry.input { match entry.input {
keys.push(key); InputMapperMessage::KeyDown(key) => keys.push(key),
InputMapperMessage::KeyUp(key) => keys.push(key),
InputMapperMessage::KeyDownNoRepeat(key) => keys.push(key),
InputMapperMessage::KeyUpNoRepeat(key) => keys.push(key),
_ => (),
} }
keys.sort_by(|a, b| { keys.sort_by(|a, b| {
@@ -121,19 +121,19 @@ pub enum ActionKeys {
impl ActionKeys { impl ActionKeys {
pub fn to_keys(&mut self, action_input_mapping: &impl Fn(&MessageDiscriminant) -> Vec<KeysGroup>) -> String { pub fn to_keys(&mut self, action_input_mapping: &impl Fn(&MessageDiscriminant) -> Vec<KeysGroup>) -> String {
match self { match self {
ActionKeys::Action(action) => { Self::Action(action) => {
if let Some(keys) = action_input_mapping(action).get_mut(0) { if let Some(keys) = action_input_mapping(action).get_mut(0) {
let mut taken_keys = KeysGroup::default(); let mut taken_keys = KeysGroup::default();
std::mem::swap(keys, &mut taken_keys); std::mem::swap(keys, &mut taken_keys);
let description = taken_keys.to_string(); let description = taken_keys.to_string();
*self = ActionKeys::Keys(taken_keys.into()); *self = Self::Keys(taken_keys.into());
description description
} else { } else {
*self = ActionKeys::Keys(KeysGroup::default().into()); *self = Self::Keys(KeysGroup::default().into());
String::new() String::new()
} }
} }
ActionKeys::Keys(keys) => { Self::Keys(keys) => {
warn!("Calling `.to_keys()` on a `ActionKeys::Keys` is a mistake/bug. Keys are: {:?}.", keys); warn!("Calling `.to_keys()` on a `ActionKeys::Keys` is a mistake/bug. Keys are: {:?}.", keys);
String::new() String::new()
} }
+32 -26
View File
@@ -653,7 +653,9 @@
</svg> </svg>
</div> </div>
<div class="thumbnail"> <div class="thumbnail">
{#if node.thumbnailSvg}
{@html node.thumbnailSvg} {@html node.thumbnailSvg}
{/if}
{#if node.primaryOutput} {#if node.primaryOutput}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -890,6 +892,7 @@
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
}
.layer, .layer,
.node { .node {
@@ -922,19 +925,6 @@
top: 0; top: 0;
} }
&.node.selected .primary {
background: rgba(255, 255, 255, 0.15);
}
&.node.selected .parameters {
background: rgba(255, 255, 255, 0.1);
}
&.layer.selected {
// This is the result of blending `rgba(255, 255, 255, 0.1)` over `rgba(0, 0, 0, 0.33)`
background: rgba(66, 66, 66, 0.4);
}
&.disabled { &.disabled {
background: var(--color-3-darkgray); background: var(--color-3-darkgray);
color: var(--color-a-softgray); color: var(--color-a-softgray);
@@ -970,18 +960,6 @@
margin: calc(24px - 8px) 0; margin: calc(24px - 8px) 0;
width: 8px; width: 8px;
height: 8px; height: 8px;
&:first-of-type {
margin-top: calc((24px - 8px) / 2);
&:not(.primary-port) {
margin-top: calc((24px - 8px) / 2 + 24px);
}
}
&:last-of-type {
margin-bottom: calc((24px - 8px) / 2);
}
} }
.expand-arrow { .expand-arrow {
@@ -1027,6 +1005,11 @@
border-radius: 8px; border-radius: 8px;
} }
&.selected {
// This is the result of blending `rgba(255, 255, 255, 0.1)` over `rgba(0, 0, 0, 0.33)`
background: rgba(66, 66, 66, 0.4);
}
.node-chain { .node-chain {
width: 36px; width: 36px;
} }
@@ -1102,6 +1085,30 @@
border-radius: 2px; border-radius: 2px;
} }
&.selected {
.primary {
background: rgba(255, 255, 255, 0.15);
}
.parameters {
background: rgba(255, 255, 255, 0.1);
}
}
.port {
&:first-of-type {
margin-top: calc((24px - 8px) / 2);
&:not(.primary-port) {
margin-top: calc((24px - 8px) / 2 + 24px);
}
}
&:last-of-type {
margin-bottom: calc((24px - 8px) / 2);
}
}
.primary { .primary {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1174,5 +1181,4 @@
} }
} }
} }
}
</style> </style>