mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Replace text-only tooltips with custom richly styled tooltips (#3436)
* Replace the title attribute with custom FloatingMenu tooltips * Separate tooltip labels and descriptions into two styled blocks * Move keyboard shortcut tooltips to a separate section at the bottom * Update shortcut key styling in tooltips and hints bar * Fix .to_string()
This commit is contained in:
@@ -215,7 +215,7 @@ impl ProtoNetwork {
|
||||
fn check_ref(&self, ref_id: &NodeId, id: &NodeId) {
|
||||
debug_assert!(
|
||||
self.nodes.iter().any(|(check_id, _)| check_id == ref_id),
|
||||
"Node id:{id} has a reference which uses node id:{ref_id} which doesn't exist in network {self:#?}"
|
||||
"Node with ID {id} has a reference which uses the node with ID {ref_id} which doesn't exist in network {self:#?}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct VariantMetadata {
|
||||
pub label: &'static str,
|
||||
|
||||
/// User-facing documentation text.
|
||||
pub docstring: Option<&'static str>,
|
||||
pub description: Option<&'static str>,
|
||||
|
||||
/// Name of icon to display in radio buttons and such.
|
||||
pub icon: Option<&'static str>,
|
||||
|
||||
@@ -254,11 +254,9 @@ impl<'i> Convert<Raster<CPU>, &'i WgpuExecutor> for Raster<GPU> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Node for uploading textures from CPU to GPU. This Is now deprecated and
|
||||
/// we should use the Convert node in the future.
|
||||
/// Uploads an raster texture from the CPU to the GPU. This Is now deprecated and the Convert node should be used in the future.
|
||||
///
|
||||
/// Accepts either individual rasters or tables of rasters and converts them
|
||||
/// to GPU format using the WgpuExecutor's device and queue.
|
||||
/// Accepts either individual raster data or a table of raster elements and converts it to the GPU format using the WgpuExecutor's device and queue.
|
||||
#[node_macro::node(category(""))]
|
||||
pub async fn upload_texture<'a: 'n, T: Convert<Table<Raster<GPU>>, &'a WgpuExecutor>>(
|
||||
_: impl Ctx,
|
||||
|
||||
@@ -141,7 +141,7 @@ fn derive_enum(enum_attributes: &[Attribute], name: Ident, input: syn::DataEnum)
|
||||
let vname = &variant.name;
|
||||
let vname_str = variant.name.to_string();
|
||||
let label = &variant.basic_item.label;
|
||||
let docstring = match &variant.basic_item.description {
|
||||
let description = match &variant.basic_item.description {
|
||||
Some(s) => {
|
||||
let s = s.trim();
|
||||
quote! { Some(#s) }
|
||||
@@ -157,7 +157,7 @@ fn derive_enum(enum_attributes: &[Attribute], name: Ident, input: syn::DataEnum)
|
||||
#name::#vname, #crate_name::choice_type::VariantMetadata {
|
||||
name: #vname_str,
|
||||
label: #label,
|
||||
docstring: #docstring,
|
||||
description: #description,
|
||||
icon: #icon,
|
||||
}
|
||||
),
|
||||
|
||||
@@ -27,7 +27,7 @@ pub fn node(attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// `#[icon("tag"))]` sets the icon to use when a variant is shown in a menu or radio button.
|
||||
///
|
||||
/// Doc comments on a variant become tooltip text.
|
||||
/// Doc comments on a variant become tooltip description text.
|
||||
#[proc_macro_derive(ChoiceType, attributes(widget, menu_separator, label, icon))]
|
||||
pub fn derive_choice_type(input_item: TokenStream) -> TokenStream {
|
||||
derive_choice_type::derive_choice_type_impl(input_item.into()).unwrap_or_else(|err| err.to_compile_error()).into()
|
||||
|
||||
@@ -77,7 +77,7 @@ fn string_split(
|
||||
#[default("\\n")]
|
||||
delimeter: String,
|
||||
/// Whether to convert escape sequences found in the delimeter into their corresponding characters:
|
||||
/// "\n" (newline), "\r" (carriage return), "\t" (tab), "\0" (null), and "\\" (backslash)
|
||||
/// "\n" (newline), "\r" (carriage return), "\t" (tab), "\0" (null), and "\\" (backslash).
|
||||
#[default(true)]
|
||||
delimeter_escaping: bool,
|
||||
) -> Vec<String> {
|
||||
|
||||
@@ -63,7 +63,7 @@ pub mod memo {
|
||||
pub const IDENTIFIER: ProtoNodeIdentifier = ProtoNodeIdentifier::new("graphene_core::memo::MemoNode");
|
||||
}
|
||||
|
||||
/// Caches the output of the last graph evaluation for introspection
|
||||
/// Caches the output of the last graph evaluation for introspection.
|
||||
#[derive(Default)]
|
||||
pub struct MonitorNode<I, T, N> {
|
||||
#[allow(clippy::type_complexity)]
|
||||
|
||||
@@ -31,17 +31,17 @@ impl ValueProvider for MathNodeContext {
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculates a mathematical expression with input values "A" and "B"
|
||||
/// Calculates a mathematical expression with input values "A" and "B".
|
||||
#[node_macro::node(category("Math: Arithmetic"), properties("math_properties"))]
|
||||
fn math<T: num_traits::float::Float>(
|
||||
_: impl Ctx,
|
||||
/// The value of "A" when calculating the expression
|
||||
/// The value of "A" when calculating the expression.
|
||||
#[implementations(f64, f32)]
|
||||
operand_a: T,
|
||||
/// A math expression that may incorporate "A" and/or "B", such as "sqrt(A + B) - B^2"
|
||||
/// A math expression that may incorporate "A" and/or "B", such as "sqrt(A + B) - B^2".
|
||||
#[default(A + B)]
|
||||
expression: String,
|
||||
/// The value of "B" when calculating the expression
|
||||
/// The value of "B" when calculating the expression.
|
||||
#[implementations(f64, f32)]
|
||||
#[default(1.)]
|
||||
operand_b: T,
|
||||
|
||||
@@ -296,7 +296,6 @@ pub fn empty_image(_: impl Ctx, transform: DAffine2, color: Table<Color>) -> Tab
|
||||
result_table
|
||||
}
|
||||
|
||||
/// Constructs a raster image.
|
||||
#[node_macro::node(category(""))]
|
||||
pub fn image_value(_: impl Ctx, _primary: (), image: Table<Raster<CPU>>) -> Table<Raster<CPU>> {
|
||||
image
|
||||
|
||||
@@ -189,8 +189,8 @@ async fn stroke<V, L: IntoF64Vec>(
|
||||
/// The threshold for when a miter-joined stroke is converted to a bevel-joined stroke when a sharp angle becomes pointier than this ratio.
|
||||
#[default(4.)]
|
||||
miter_limit: f64,
|
||||
// <https://svgwg.org/svg2-draft/painting.html#PaintOrderProperty>
|
||||
/// The order to paint the stroke on top of the fill, or the fill on top of the stroke.
|
||||
/// <https://svgwg.org/svg2-draft/painting.html#PaintOrderProperty>
|
||||
paint_order: PaintOrder,
|
||||
/// The stroke dash lengths. Each length forms a distance in a pattern where the first length is a dash, the second is a gap, and so on. If the list is an odd length, the pattern repeats with solid-gap roles reversed.
|
||||
#[implementations(Vec<f64>, f64, String, Vec<f64>, f64, String)]
|
||||
|
||||
Reference in New Issue
Block a user