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

View File

@ -46,13 +46,14 @@ impl InputMapperMessageHandler {
}
pub fn action_input_mapping(&self, action_to_find: &MessageDiscriminant) -> Vec<KeysGroup> {
let key_up = self.mapping.key_up.iter();
let key_down = self.mapping.key_down.iter();
let double_click = std::iter::once(&self.mapping.double_click);
let wheel_scroll = std::iter::once(&self.mapping.wheel_scroll);
let pointer_move = std::iter::once(&self.mapping.pointer_move);
let all_key_mapping_entries = key_up.chain(key_down).chain(double_click).chain(wheel_scroll).chain(pointer_move);
let all_key_mapping_entries = std::iter::empty()
.chain(self.mapping.key_up.iter())
.chain(self.mapping.key_down.iter())
.chain(self.mapping.key_up_no_repeat.iter())
.chain(self.mapping.key_down_no_repeat.iter())
.chain(std::iter::once(&self.mapping.double_click))
.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());
// Filter for the desired message
@ -69,15 +70,18 @@ impl InputMapperMessageHandler {
// TODO: Use a safe solution eventually
assert!(
i < input_keyboard::NUMBER_OF_KEYS,
"Attempting to convert a Key with enum index {}, which is larger than the number of Key enums",
i
"Attempting to convert a Key with enum index {i}, which is larger than the number of Key enums",
);
(i as u8).try_into().unwrap()
})
.collect::<Vec<_>>();
if let InputMapperMessage::KeyDown(key) = entry.input {
keys.push(key);
match entry.input {
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| {

View File

@ -121,19 +121,19 @@ pub enum ActionKeys {
impl ActionKeys {
pub fn to_keys(&mut self, action_input_mapping: &impl Fn(&MessageDiscriminant) -> Vec<KeysGroup>) -> String {
match self {
ActionKeys::Action(action) => {
Self::Action(action) => {
if let Some(keys) = action_input_mapping(action).get_mut(0) {
let mut taken_keys = KeysGroup::default();
std::mem::swap(keys, &mut taken_keys);
let description = taken_keys.to_string();
*self = ActionKeys::Keys(taken_keys.into());
*self = Self::Keys(taken_keys.into());
description
} else {
*self = ActionKeys::Keys(KeysGroup::default().into());
*self = Self::Keys(KeysGroup::default().into());
String::new()
}
}
ActionKeys::Keys(keys) => {
Self::Keys(keys) => {
warn!("Calling `.to_keys()` on a `ActionKeys::Keys` is a mistake/bug. Keys are: {:?}.", keys);
String::new()
}

View File

@ -653,7 +653,9 @@
</svg>
</div>
<div class="thumbnail">
{#if node.thumbnailSvg}
{@html node.thumbnailSvg}
{/if}
{#if node.primaryOutput}
<svg
xmlns="http://www.w3.org/2000/svg"
@ -890,6 +892,7 @@
position: absolute;
width: 100%;
height: 100%;
}
.layer,
.node {
@ -922,19 +925,6 @@
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 {
background: var(--color-3-darkgray);
color: var(--color-a-softgray);
@ -970,18 +960,6 @@
margin: calc(24px - 8px) 0;
width: 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 {
@ -1027,6 +1005,11 @@
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 {
width: 36px;
}
@ -1102,6 +1085,30 @@
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 {
display: flex;
align-items: center;
@ -1174,5 +1181,4 @@
}
}
}
}
</style>