Skip to content

Commit e041880

Browse files
committed
Update shortcut key styling in tooltips and hints bar
1 parent 797acce commit e041880

11 files changed

Lines changed: 134 additions & 61 deletions

File tree

editor/src/messages/input_mapper/utility_types/input_keyboard.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ impl fmt::Display for Key {
296296
KeyboardPlatformLayout::Standard => "Ctrl",
297297
KeyboardPlatformLayout::Mac => "⌘",
298298
},
299-
Self::MouseLeft => "LMB",
300-
Self::MouseRight => "RMB",
301-
Self::MouseMiddle => "MMB",
299+
Self::MouseLeft => "Click",
300+
Self::MouseRight => "R.Click",
301+
Self::MouseMiddle => "M.Click",
302302
Self::MouseBack => "Mouse Back",
303303
Self::MouseForward => "Mouse Fwd",
304304

editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::utility_types::{BoxSelection, ContextMenuInformation, DragStart, FrontendNode};
22
use super::{document_node_definitions, node_properties};
33
use crate::consts::GRID_SIZE;
4+
use crate::messages::input_mapper::utility_types::input_keyboard::KeysGroup;
45
use crate::messages::input_mapper::utility_types::macros::action_keys;
56
use crate::messages::layout::utility_types::widget_prelude::*;
67
use crate::messages::portfolio::document::document_message_handler::navigation_controls;
@@ -2107,7 +2108,7 @@ impl NodeGraphMessageHandler {
21072108
.icon(Some("Node".to_string()))
21082109
.tooltip_label("New Node")
21092110
.tooltip_description("To add a node at the pointer location, perform the shortcut in an open area of the graph.")
2110-
.tooltip_shortcut("RMB")
2111+
.tooltip_shortcut(Key::MouseRight.to_string())
21112112
.popover_layout({
21122113
// Showing only compatible types
21132114
let compatible_type = match (selection_includes_layers, has_multiple_selection, selected_layer) {
@@ -2224,7 +2225,7 @@ impl NodeGraphMessageHandler {
22242225
.icon(Some("FrameAll".to_string()))
22252226
.tooltip_label("Preview")
22262227
.tooltip_description("Temporarily set the graph output to the selected node or layer. Perform the shortcut on a node or layer for quick access.")
2227-
.tooltip_shortcut("Alt LMB")
2228+
.tooltip_shortcut(KeysGroup(vec![Key::Alt, Key::MouseLeft]))
22282229
.on_update(move |_| NodeGraphMessage::TogglePreview { node_id }.into())
22292230
.widget_holder();
22302231
widgets.extend([Separator::new(SeparatorType::Unrelated).widget_holder(), button]);

editor/src/messages/tool/tool_messages/path_tool.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::consts::{
44
COLOR_OVERLAY_BLUE, COLOR_OVERLAY_GRAY, COLOR_OVERLAY_GREEN, COLOR_OVERLAY_RED, DEFAULT_STROKE_WIDTH, DOUBLE_CLICK_MILLISECONDS, DRAG_DIRECTION_MODE_DETERMINATION_THRESHOLD, DRAG_THRESHOLD,
55
DRILL_THROUGH_THRESHOLD, HANDLE_ROTATE_SNAP_ANGLE, SEGMENT_INSERTION_DISTANCE, SEGMENT_OVERLAY_SIZE, SELECTION_THRESHOLD, SELECTION_TOLERANCE,
66
};
7+
use crate::messages::input_mapper::utility_types::input_keyboard::KeysGroup;
78
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
89
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_document_node_type;
910
use crate::messages::portfolio::document::overlays::utility_functions::{path_overlays, selected_segments};
@@ -269,15 +270,15 @@ impl LayoutHolder for PathTool {
269270
.icon("Dot")
270271
.tooltip_label("Point Editing Mode")
271272
.tooltip_description("To multi-select modes, perform the shortcut shown.")
272-
.tooltip_shortcut("Shift LMB")
273+
.tooltip_shortcut(KeysGroup(vec![Key::Shift, Key::MouseLeft]))
273274
.on_update(|_| PathToolMessage::TogglePointEditing.into())
274275
.widget_holder();
275276
let segment_editing_mode = CheckboxInput::new(self.options.path_editing_mode.segment_editing_mode)
276277
// TODO(Keavon): Replace with a real icon
277278
.icon("Remove")
278279
.tooltip_label("Segment Editing Mode")
279280
.tooltip_description("To multi-select modes, perform the shortcut shown.")
280-
.tooltip_shortcut("Shift LMB")
281+
.tooltip_shortcut(KeysGroup(vec![Key::Shift, Key::MouseLeft]))
281282
.on_update(|_| PathToolMessage::ToggleSegmentEditing.into())
282283
.widget_holder();
283284

editor/src/messages/tool/utility_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,26 +429,26 @@ fn list_tools_in_groups() -> Vec<Vec<ToolAvailability>> {
429429
ToolEntry::new(ToolType::Heal, "RasterHealTool")
430430
.tooltip_label("Heal Tool")
431431
.tooltip_description("Coming soon.")
432-
.tooltip_shortcut("J"),
432+
.tooltip_shortcut(Key::KeyJ.to_string()),
433433
),
434434
ToolAvailability::ComingSoon(
435435
ToolEntry::new(ToolType::Clone, "RasterCloneTool")
436436
.tooltip_label("Clone Tool")
437437
.tooltip_description("Coming soon.")
438-
.tooltip_shortcut("C"),
438+
.tooltip_shortcut(Key::KeyC.to_string()),
439439
),
440440
ToolAvailability::ComingSoon(ToolEntry::new(ToolType::Patch, "RasterPatchTool").tooltip_label("Patch Tool").tooltip_description("Coming soon.")),
441441
ToolAvailability::ComingSoon(
442442
ToolEntry::new(ToolType::Detail, "RasterDetailTool")
443443
.tooltip_label("Detail Tool")
444444
.tooltip_description("Coming soon.")
445-
.tooltip_shortcut("D"),
445+
.tooltip_shortcut(Key::KeyD.to_string()),
446446
),
447447
ToolAvailability::ComingSoon(
448448
ToolEntry::new(ToolType::Relight, "RasterRelightTool")
449449
.tooltip_label("Relight Tool")
450450
.tooltip_description("Coming soon.")
451-
.tooltip_shortcut("O"),
451+
.tooltip_shortcut(Key::KeyO.to_string()),
452452
),
453453
],
454454
]

frontend/src/components/floating-menus/ColorPicker.svelte

Lines changed: 80 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
blue: [0, 0, 1],
3232
magenta: [1, 0, 1],
3333
};
34+
const PURE_COLORS_GRAYABLE = [
35+
["Red", "#ff0000", "#4c4c4c"],
36+
["Yellow", "#ffff00", "#e3e3e3"],
37+
["Green", "#00ff00", "#969696"],
38+
["Cyan", "#00ffff", "#b2b2b2"],
39+
["Blue", "#0000ff", "#1c1c1c"],
40+
["Magenta", "#ff00ff", "#696969"],
41+
];
3442
3543
const editor = getContext<Editor>("editor");
3644
@@ -422,7 +430,8 @@
422430
<LayoutRow class="pickers">
423431
<LayoutCol
424432
class="saturation-value-picker"
425-
data-tooltip-label={disabled ? "Saturation and Value (Disabled)" : "Saturation and Value"}
433+
data-tooltip-label="Saturation and Value"
434+
data-tooltip-description={disabled ? "Disabled (read-only)." : ""}
426435
on:pointerdown={onPointerDown}
427436
data-saturation-value-picker
428437
>
@@ -439,12 +448,24 @@
439448
/>
440449
{/if}
441450
</LayoutCol>
442-
<LayoutCol class="hue-picker" data-tooltip-label={disabled ? "Hue (Disabled)" : "Hue"} on:pointerdown={onPointerDown} data-hue-picker>
451+
<LayoutCol
452+
class="hue-picker"
453+
data-tooltip-label="Hue"
454+
data-tooltip-description={"The shade along the spectrum of the rainbow." + (disabled ? "\n\nDisabled (read-only)." : "")}
455+
on:pointerdown={onPointerDown}
456+
data-hue-picker
457+
>
443458
{#if !isNone}
444459
<div class="selection-needle" style:top={`${(1 - hue) * 100}%`} />
445460
{/if}
446461
</LayoutCol>
447-
<LayoutCol class="alpha-picker" data-tooltip-label={disabled ? "Alpha (Disabled)" : "Alpha"} on:pointerdown={onPointerDown} data-alpha-picker>
462+
<LayoutCol
463+
class="alpha-picker"
464+
data-tooltip-label="Alpha"
465+
data-tooltip-description={"The level of translucency." + (disabled ? "\n\nDisabled (read-only)." : "")}
466+
on:pointerdown={onPointerDown}
467+
data-alpha-picker
468+
>
448469
{#if !isNone}
449470
<div class="selection-needle" style:top={`${(1 - alpha) * 100}%`} />
450471
{/if}
@@ -484,7 +505,7 @@
484505
class="choice-preview"
485506
classes={{ outlined, transparency }}
486507
styles={{ "--outline-amount": outlineFactor }}
487-
tooltipDescription={!newColor.equals(oldColor) ? "Comparison between the present color choice (left) and the color before any change was made (right)." : "The present color choice."}
508+
tooltipDescription={!newColor.equals(oldColor) ? "Comparison between the present color choice (left) and the color before it was changed (right)." : "The present color choice."}
488509
>
489510
{#if !newColor.equals(oldColor) && !disabled}
490511
<div class="swap-button-background"></div>
@@ -503,7 +524,10 @@
503524
</LayoutRow>
504525
<!-- <DropdownInput entries={[[{ label: "sRGB" }]]} selectedIndex={0} disabled={true} tooltipDescription="Color model, color space, and HDR (coming soon)." /> -->
505526
<LayoutRow>
506-
<TextLabel tooltipDescription={"Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."}>Hex</TextLabel>
527+
<TextLabel
528+
tooltipLabel="Hex Color Code"
529+
tooltipDescription={"Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."}>Hex</TextLabel
530+
>
507531
<Separator type="Related" />
508532
<LayoutRow>
509533
<TextInput
@@ -514,13 +538,14 @@
514538
setColorCode(detail);
515539
}}
516540
centered={true}
541+
tooltipLabel="Hex Color Code"
517542
tooltipDescription={"Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."}
518543
bind:this={hexCodeInputWidget}
519544
/>
520545
</LayoutRow>
521546
</LayoutRow>
522547
<LayoutRow>
523-
<TextLabel tooltipDescription="Red/Green/Blue channels of the color, integers 0–255.">RGB</TextLabel>
548+
<TextLabel tooltipLabel="Red/Green/Blue" tooltipDescription="Integers 0–255.">RGB</TextLabel>
524549
<Separator type="Related" />
525550
<LayoutRow>
526551
{#each rgbChannels as [channel, strength], index}
@@ -540,17 +565,17 @@
540565
min={0}
541566
max={255}
542567
minWidth={1}
543-
tooltipDescription={`${{ r: "Red", g: "Green", b: "Blue" }[channel]} channel, integers 0–255.`}
568+
tooltipLabel={{ r: "Red Channel", g: "Green Channel", b: "Blue Channel" }[channel]}
569+
tooltipDescription="Integers 0–255."
544570
/>
545571
{/each}
546572
</LayoutRow>
547573
</LayoutRow>
548574
<LayoutRow>
549575
<TextLabel
550-
tooltipDescription={"Hue/Saturation/Value, also known as Hue/Saturation/Brightness (HSB).\nNot to be confused with Hue/Saturation/Lightness (HSL), a different color model."}
576+
tooltipLabel="Hue/Saturation/Value"
577+
tooltipDescription="Also known as Hue/Saturation/Brightness (HSB). Not to be confused with Hue/Saturation/Lightness (HSL), a different color model.">HSV</TextLabel
551578
>
552-
HSV
553-
</TextLabel>
554579
<Separator type="Related" />
555580
<LayoutRow>
556581
{#each hsvChannels as [channel, strength], index}
@@ -572,17 +597,22 @@
572597
unit={channel === "h" ? "°" : "%"}
573598
minWidth={1}
574599
displayDecimalPlaces={1}
600+
tooltipLabel={{
601+
h: "Hue Component",
602+
s: "Saturation Component",
603+
v: "Value Component",
604+
}[channel]}
575605
tooltipDescription={{
576-
h: `Hue component, the shade along the spectrum of the rainbow.`,
577-
s: `Saturation component, the vividness from grayscale to full color.`,
578-
v: "Value component, the brightness from black to full color.",
606+
h: "The shade along the spectrum of the rainbow.",
607+
s: "The vividness from grayscale to full color.",
608+
v: "The brightness from black to full color.",
579609
}[channel]}
580610
/>
581611
{/each}
582612
</LayoutRow>
583613
</LayoutRow>
584614
<LayoutRow>
585-
<TextLabel tooltipDescription="Scale of translucency, from transparent (0%) to opaque (100%), for the color's alpha channel.">Alpha</TextLabel>
615+
<TextLabel tooltipLabel="Alpha" tooltipDescription="The level of translucency, from transparent (0%) to opaque (100%).">Alpha</TextLabel>
586616
<Separator type="Related" />
587617
<NumberInput
588618
value={!isNone ? alpha * 100 : undefined}
@@ -601,29 +631,54 @@
601631
unit="%"
602632
mode="Range"
603633
displayDecimalPlaces={1}
604-
tooltipDescription="Scale of translucency, from transparent (0%) to opaque (100%), for the color's alpha channel."
634+
tooltipLabel="Alpha"
635+
tooltipDescription="The level of translucency, from transparent (0%) to opaque (100%)."
605636
/>
606637
</LayoutRow>
607638
<LayoutRow class="leftover-space" />
608639
<LayoutRow>
609640
{#if allowNone && !gradient}
610-
<button class="preset-color none" {disabled} on:click={() => setColorPreset("none")} data-tooltip-label="Set to No Color" tabindex="0"></button>
641+
<button
642+
class="preset-color none"
643+
{disabled}
644+
on:click={() => setColorPreset("none")}
645+
data-tooltip-label="Set to No Color"
646+
data-tooltip-description={disabled ? "Disabled (read-only)." : ""}
647+
tabindex="0"
648+
></button>
611649
<Separator type="Related" />
612650
{/if}
613-
<button class="preset-color black" {disabled} on:click={() => setColorPreset("black")} data-tooltip-label="Set to Black" tabindex="0"></button>
651+
<button
652+
class="preset-color black"
653+
{disabled}
654+
on:click={() => setColorPreset("black")}
655+
data-tooltip-label="Set to Black"
656+
data-tooltip-description={disabled ? "Disabled (read-only)." : ""}
657+
tabindex="0"
658+
></button>
614659
<Separator type="Related" />
615-
<button class="preset-color white" {disabled} on:click={() => setColorPreset("white")} data-tooltip-label="Set to White" tabindex="0"></button>
660+
<button
661+
class="preset-color white"
662+
{disabled}
663+
on:click={() => setColorPreset("white")}
664+
data-tooltip-label="Set to White"
665+
data-tooltip-description={disabled ? "Disabled (read-only)." : ""}
666+
tabindex="0"
667+
></button>
616668
<Separator type="Related" />
617669
<button class="preset-color pure" {disabled} on:click={setColorPresetSubtile} tabindex="-1">
618-
<div data-pure-tile="red" style="--pure-color: #ff0000; --pure-color-gray: #4c4c4c" data-tooltip-label="Set to Red" />
619-
<div data-pure-tile="yellow" style="--pure-color: #ffff00; --pure-color-gray: #e3e3e3" data-tooltip-label="Set to Yellow" />
620-
<div data-pure-tile="green" style="--pure-color: #00ff00; --pure-color-gray: #969696" data-tooltip-label="Set to Green" />
621-
<div data-pure-tile="cyan" style="--pure-color: #00ffff; --pure-color-gray: #b2b2b2" data-tooltip-label="Set to Cyan" />
622-
<div data-pure-tile="blue" style="--pure-color: #0000ff; --pure-color-gray: #1c1c1c" data-tooltip-label="Set to Blue" />
623-
<div data-pure-tile="magenta" style="--pure-color: #ff00ff; --pure-color-gray: #696969" data-tooltip-label="Set to Magenta" />
670+
{#each PURE_COLORS_GRAYABLE as [name, color, gray]}
671+
<div
672+
data-pure-tile={name.toLowerCase()}
673+
style:--pure-color={color}
674+
style:--pure-color-gray={gray}
675+
data-tooltip-label="Set to Red"
676+
data-tooltip-description={disabled ? "Disabled (read-only)." : ""}
677+
/>
678+
{/each}
624679
</button>
625680
<Separator type="Related" />
626-
<IconButton icon="Eyedropper" size={24} {disabled} action={activateEyedropperSample} tooltipDescription="Sample a pixel color from the document." />
681+
<IconButton icon="Eyedropper" size={24} {disabled} action={activateEyedropperSample} tooltipLabel="Eyedropper" tooltipDescription="Sample a pixel color from the document." />
627682
</LayoutRow>
628683
</LayoutCol>
629684
</LayoutRow>

frontend/src/components/floating-menus/Tooltip.svelte

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import type { TooltipState } from "@graphite/state-providers/tooltip";
66
77
import FloatingMenu from "@graphite/components/layout/FloatingMenu.svelte";
8+
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
89
import TextLabel from "@graphite/components/widgets/labels/TextLabel.svelte";
910
1011
const tooltip = getContext<TooltipState>("tooltip");
@@ -26,15 +27,19 @@
2627
<div class="tooltip" style:top={`${$tooltip.position.y}px`} style:left={`${$tooltip.position.x}px`}>
2728
{#if label || description}
2829
<FloatingMenu open={true} type="Tooltip" direction="Bottom" bind:this={self}>
29-
{#if label}
30-
<TextLabel class="tooltip-label">{label}</TextLabel>
30+
{#if label || shortcut}
31+
<LayoutRow class="tooltip-header">
32+
{#if label}
33+
<TextLabel class="tooltip-label">{label}</TextLabel>
34+
{/if}
35+
{#if shortcut}
36+
<TextLabel class="tooltip-shortcut">{shortcut}</TextLabel>
37+
{/if}
38+
</LayoutRow>
3139
{/if}
3240
{#if description}
3341
<TextLabel class="tooltip-description">{description}</TextLabel>
3442
{/if}
35-
{#if shortcut}
36-
<TextLabel class="tooltip-shortcut">Shortcut: {shortcut}</TextLabel>
37-
{/if}
3843
</FloatingMenu>
3944
{/if}
4045
</div>
@@ -49,17 +54,27 @@
4954
.floating-menu-content {
5055
max-width: Min(400px, 50vw);
5156
57+
.tooltip-header + .tooltip-description {
58+
margin-top: 4px;
59+
}
60+
5261
.text-label {
5362
white-space: pre-wrap;
63+
}
5464
55-
+ .text-label {
56-
margin-top: 4px;
57-
}
65+
.text-label + .tooltip-shortcut {
66+
margin-left: 8px;
67+
}
68+
69+
.tooltip-shortcut {
70+
color: var(--color-b-lightgray);
71+
background: var(--color-3-darkgray);
72+
padding: 0 4px;
73+
border-radius: 4px;
74+
}
5875
59-
&.tooltip-description,
60-
&.tooltip-shortcut {
61-
color: var(--color-b-lightgray);
62-
}
76+
.tooltip-description {
77+
color: var(--color-b-lightgray);
6378
}
6479
}
6580
}

frontend/src/components/panels/Layers.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@
623623
? "Hide the layers nested within. (To affect all open descendants, perform the shortcut shown.)"
624624
: "Show the layers nested within. (To affect all closed descendants, perform the shortcut shown.)") +
625625
(listing.entry.ancestorOfSelected && !listing.entry.expanded ? "\n\nNote: a selected layer is currently contained within.\n" : "")}
626-
data-tooltip-shortcut="Alt LMB"
626+
data-tooltip-shortcut="Alt Click"
627627
on:click={(e) => handleExpandArrowClickWithModifiers(e, listing.entry.id)}
628628
tabindex="0"
629629
></button>
@@ -635,7 +635,7 @@
635635
icon="Clipped"
636636
class="clipped-arrow"
637637
tooltipDescription="Clipping mask is active. To release it, perform the shortcut on the layer border."
638-
tooltipShortcut="Alt LMB"
638+
tooltipShortcut="Alt Click"
639639
/>
640640
{/if}
641641
<div class="thumbnail">

frontend/src/components/widgets/inputs/CurveInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
}
8080
8181
function handleManipulatorPointerDown(e: PointerEvent, i: number) {
82-
// Delete an anchor with RMB or MMB
82+
// Delete an anchor with right click or middle click
8383
if (e.button > 0 && i > 0 && i < manipulatorsList.length - 1) {
8484
draggedNodeIndex = undefined;
8585
selectedNodeIndex = undefined;

0 commit comments

Comments
 (0)