mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 06:38:44 +00:00
Merge pull request #8141 from dotCooCoo/chore/no-app-names-in-comments
UI: comments describe the behavior instead of comparing it with other apps
This commit is contained in:
@@ -175,7 +175,7 @@ enum Drag {
|
||||
},
|
||||
/// A Selection tool move over a panel or toolbar: the art waits where it last moved on the
|
||||
/// canvas, and the panels get it ([`widgets::PanelDrag::Art`]) if it is released there. Back
|
||||
/// on the canvas the move goes on, as in Illustrator (#2826).
|
||||
/// on the canvas the move goes on (#2826).
|
||||
Art,
|
||||
/// Fingers making a touch gesture ([`crate::touch`]): the first one's press does nothing.
|
||||
Gesture,
|
||||
@@ -832,7 +832,7 @@ fn frame_options(
|
||||
// Type › Highlight Substituted Fonts: pink behind text in a substitute font.
|
||||
highlight_substituted_fonts: app.session.prefs.highlight_substituted_fonts,
|
||||
// General › Anti-aliased Artwork: off, edges are hard on screen (raster effects and
|
||||
// pattern tiles stay smooth), as in Illustrator.
|
||||
// pattern tiles stay smooth).
|
||||
anti_alias: if app.session.prefs.anti_aliased_artwork { vectorcraft_render::AntiAlias::Art } else { vectorcraft_render::AntiAlias::None },
|
||||
progressive_placed: true,
|
||||
trace_views: true,
|
||||
|
||||
@@ -432,7 +432,7 @@ pub(super) fn rulers(ui: &Ui, full: egui::Rect, xf: &Xf, hover: Option<Point>, s
|
||||
let sy = left.top() + d;
|
||||
clip_left.line_segment([pos2(left.right() - len, sy), pos2(left.right(), sy)], Stroke::new(1.0, t.ruler_tick));
|
||||
if let Some(text) = label {
|
||||
// Vertical labels read top-to-bottom, one digit per line like Illustrator.
|
||||
// Vertical labels read top-to-bottom, one digit per line.
|
||||
let top = sy + 2.0;
|
||||
if top < filled_to {
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,7 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) {
|
||||
/// The Home screen's column: welcome, New / Open, Recent Files, Learn, presets and community links.
|
||||
fn home_content(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
// The welcome and the New / Open buttons sit centred, as PhotoCraft's Home screen does (#4684).
|
||||
// The welcome and the New / Open buttons sit centred (#4684).
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Welcome to VectorCraft")).font(theme::semibold(26.0)).color(t.text));
|
||||
ui.add_space(4.0);
|
||||
|
||||
@@ -94,7 +94,7 @@ pub(super) const HOLD_DELAY: f32 = 0.3;
|
||||
/// …and how fast it zooms then (as `exp(seconds × HOLD_ZOOM)`: twice as close each second).
|
||||
pub(super) const HOLD_ZOOM: f64 = std::f64::consts::LN_2;
|
||||
|
||||
/// Performance › Animated Zoom, which needs GPU Performance as in Illustrator: the Zoom tool zooms
|
||||
/// Performance › Animated Zoom, which needs GPU Performance: the Zoom tool zooms
|
||||
/// as it is dragged sideways or held, instead of zooming to the area dragged across, and a wheel
|
||||
/// notch's zoom glides in ([`wheel`]).
|
||||
pub(crate) fn animated_zoom(p: &vectorcraft_engine::Prefs) -> bool {
|
||||
|
||||
@@ -36,7 +36,7 @@ use tabs::{CLOSE_BEFORE_TITLE, first_tab_shown, tab_drop, tab_groups, tab_title}
|
||||
pub use tabs::{doc_tabs, isolation_bar, step_document};
|
||||
pub(crate) use tabs::{document_window_title, show_document, window_tab};
|
||||
|
||||
/// The application bar's height, in points (compact, as in PhotoCraft).
|
||||
/// The application bar's height, in points (compact).
|
||||
pub const APP_BAR_HEIGHT: f32 = 32.0;
|
||||
/// The brand mark's side.
|
||||
const MARK: f32 = 18.0;
|
||||
|
||||
@@ -886,7 +886,7 @@ fn gripper(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, d
|
||||
}
|
||||
}
|
||||
|
||||
/// The Control bar (Window → Control), context-sensitive like Illustrator's, docked to the top or
|
||||
/// The Control bar (Window → Control), context-sensitive, docked to the top or
|
||||
/// the bottom of the window, or floating over the window below the menu bar, where it takes no room
|
||||
/// from the canvas. A floating bar is [`FLOAT_WIDTH`] wide, or as wide as the window when that is
|
||||
/// narrower, and is kept inside the window when the window shrinks.
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn discord_button(app: &mut VectorcraftApp, ui: &mut Ui, large: bool) -> egu
|
||||
let ir = egui::Rect::from_center_size(r.left_center() + vec2(h * 0.35 + icon / 2.0, 0.0), vec2(icon, icon));
|
||||
if large {
|
||||
// The theme's accent, as the primary buttons use it, so the call to action matches the
|
||||
// rest of the window (and PhotoCraft's, #4684); Discord's colour stays on the app-bar icon.
|
||||
// rest of the window (#4684); Discord's colour stays on the app-bar icon.
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let fill = if resp.hovered() { t.accent } else { t.accent_strong };
|
||||
ui.painter().rect_filled(r, CornerRadius::same((h / 2.0) as u8), fill);
|
||||
@@ -77,7 +77,7 @@ pub fn links(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
links_in(app, ui, false);
|
||||
}
|
||||
|
||||
/// [`links`] for a centred column (the Home screen's, as PhotoCraft's, #4684): the Discord button
|
||||
/// [`links`] for a centred column (the Home screen's, #4684): the Discord button
|
||||
/// and the links, each in the middle.
|
||||
pub fn links_centered(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
links_in(app, ui, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Tool cursors drawn as vector glyphs (egui only offers system cursors). Black shapes with a white
|
||||
//! halo, hotspot at `p`, Illustrator's visual grammar: solid arrow (Selection), hollow arrow (Direct
|
||||
//! halo, hotspot at `p`, one shape per tool: solid arrow (Selection), hollow arrow (Direct
|
||||
//! Selection), pen nib with state badges, crosshair for drawing tools, curved arrows for rotate.
|
||||
//!
|
||||
//! The desktop app shows them as OS cursors ([`Images`]): the system moves those itself, at once,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Effect → Effect Gallery: browse Photoshop-style raster filters by category, build a stack, and
|
||||
//! Effect → Effect Gallery: browse raster filters by category, build a stack, and
|
||||
//! apply it as separate appearance effects in one undo step.
|
||||
//!
|
||||
//! Each filter has a thumbnail, and the dialog has its own preview, as the
|
||||
@@ -29,7 +29,7 @@ const PREVIEW_H: usize = 84;
|
||||
/// Dialog kind for the Effect Gallery.
|
||||
pub const KIND: &str = "effectGallery";
|
||||
|
||||
/// Raster effect submenus in the gallery (the six Photoshop-style folders it holds).
|
||||
/// Raster effect submenus in the gallery (the six raster filter folders it holds).
|
||||
const CATEGORIES: [(&str, &[&str]); 6] = [
|
||||
("Artistic", &["Effect", "Artistic"]),
|
||||
("Brush Strokes", &["Effect", "Brush Strokes"]),
|
||||
@@ -434,7 +434,7 @@ fn sample_drawing(w: usize, h: usize) -> Vec<u8> {
|
||||
out
|
||||
}
|
||||
|
||||
/// Run one Photoshop-style filter on a premultiplied RGBA buffer. Leaves it unchanged when `id`
|
||||
/// Run one raster filter on a premultiplied RGBA buffer. Leaves it unchanged when `id`
|
||||
/// is not one of those filters or the buffer is the wrong size.
|
||||
fn apply_pixel(id: &str, params: &Map<String, Value>, data: &mut [u8], w: usize, h: usize) {
|
||||
let Some(n) = w.checked_mul(h).and_then(|n| n.checked_mul(4)) else { return };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! File → Export → Export for Screens, laid out as Illustrator's: on the left the Artboards and
|
||||
//! File → Export → Export for Screens: on the left the Artboards and
|
||||
//! Assets tabs (thumbnails with checkboxes, in a grid or a list), Clear Selection and the prefix;
|
||||
//! on the right Select (All, a range or Full Document, Include Bleed, Include Artboard Fill), the destination (folder
|
||||
//! picker, Open Location after Export, Create Sub-folders by scale or by format; the web downloads
|
||||
@@ -721,7 +721,7 @@ fn tiles(
|
||||
ui.painter().galley(label_pos, galley, t.text);
|
||||
false
|
||||
};
|
||||
// The checkbox sits on the thumbnail's lower left corner, as Illustrator's.
|
||||
// The checkbox sits on the thumbnail's lower left corner.
|
||||
let bx = egui::Rect::from_min_size(egui::pos2(pic.left() + 4.0, pic.bottom() - 18.0), egui::vec2(14.0, 14.0));
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(bx));
|
||||
if widgets::check_box(&mut child, &name, checked, true) || resp.clicked() || caption_clicked {
|
||||
|
||||
@@ -996,7 +996,7 @@
|
||||
Free Transform Volná transformace
|
||||
Perspective Distort Perspektivní deformace
|
||||
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Radial Blur… Radiální rozostření…
|
||||
Blur Center Střed rozostření
|
||||
Smart Blur… Chytré rozostření…
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -18,7 +18,7 @@
|
||||
# `untranslated_report` lists gaps) — and the status and error messages. Left in English on purpose (`MENU_KEEP_AS_IS` in the
|
||||
# tests): the product name, language names, OpenType, the built-in workspace names and the bracketed
|
||||
# perspective grid preset names; `de-DE`, `de-AT`, `de-CH` and every other `de-*` locale resolve here.
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Glowing Edges… Leuchtende Konturen…
|
||||
Glowing Edges Leuchtende Konturen
|
||||
Edge Width Kantenbreite
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -11,7 +11,7 @@
|
||||
# Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`,
|
||||
# `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language
|
||||
# names, OpenType, the built-in workspace names and the bracketed perspective grid preset names.
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Glowing Edges… Bordes resplandecientes…
|
||||
Glowing Edges Bordes resplandecientes
|
||||
Edge Width Ancho del borde
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -12,7 +12,7 @@
|
||||
# Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`,
|
||||
# `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language
|
||||
# names, OpenType, the built-in workspace names and the bracketed perspective grid preset names.
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Glowing Edges… Contour lumineux…
|
||||
Glowing Edges Contour lumineux
|
||||
Edge Width Largeur du bord
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -11,7 +11,7 @@
|
||||
# Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`,
|
||||
# `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language
|
||||
# names, OpenType, the built-in workspace names and the bracketed perspective grid preset names.
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Glowing Edges… Bordi luminosi…
|
||||
Glowing Edges Bordi luminosi
|
||||
Edge Width Larghezza bordo
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4547,7 +4547,7 @@ theme Appearance 外観
|
||||
Free Transform 自由変形
|
||||
Perspective Distort 遠近変形
|
||||
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Radial Blur… ぼかし (放射状)…
|
||||
Blur Center ぼかしの中心
|
||||
Smart Blur… ぼかし (詳細)…
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -9,7 +9,7 @@
|
||||
# Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`,
|
||||
# `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language
|
||||
# names, OpenType, the built-in workspace names and the bracketed perspective grid preset names.
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Glowing Edges… Светящиеся края…
|
||||
Glowing Edges Светящиеся края
|
||||
Edge Width Ширина края
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5928,7 +5928,7 @@ axis Both 两者
|
||||
Constrain 约束
|
||||
Perspective Distort 透视扭曲
|
||||
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Radial Blur… 径向模糊…
|
||||
Blur Center 模糊中心
|
||||
Smart Blur… 智能模糊…
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5759,7 +5759,7 @@ axis Both 兩者
|
||||
Free Transform 任意變形
|
||||
Perspective Distort 透視扭曲
|
||||
|
||||
# Photoshop-style raster effects (Effect menu, their dialogs).
|
||||
# Raster effects (Effect menu, their dialogs).
|
||||
Radial Blur… 放射狀模糊…
|
||||
Blur Center 模糊中心
|
||||
Smart Blur… 智慧型模糊…
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1,4 +1,4 @@
|
||||
//! VectorCraft's egui frontend: an Illustrator-style UI over `vectorcraft-engine`.
|
||||
//! VectorCraft's egui frontend: menus, tools, panels and dialogs over `vectorcraft-engine`.
|
||||
//!
|
||||
//! The UI is thin: every action goes through [`VectorcraftApp::run`], which dispatches UI commands
|
||||
//! (view/window) here and everything else to the engine. The same entry point serves menus,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The menu bar (Illustrator's menu tree) and UI-level commands.
|
||||
//! The menu bar (the full menu tree) and UI-level commands.
|
||||
//!
|
||||
//! Items bound to a command id run through [`VectorcraftApp::run`]. Items not implemented yet are
|
||||
//! listed (disabled, with their shortcut) so the full surface is visible and discoverable; the
|
||||
|
||||
@@ -25,7 +25,7 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 {
|
||||
let mut clicked: Option<(String, Value)> = None;
|
||||
let mut file_open = false;
|
||||
let tree = menu_tree_named(app.session.prefs.font_names_in_english);
|
||||
// No application menu in the window (as in Illustrator): the bar starts at File on every
|
||||
// No application menu in the window: the bar starts at File on every
|
||||
// platform. The VectorCraft menu stays in the tree: the native Mac bar takes it from there.
|
||||
let tree: Vec<(&str, Vec<Item>)> = tree.into_iter().filter(|(title, _)| *title != "VectorCraft").collect();
|
||||
// A menu bar for its layout and menu-button style, but the titles use `Popup::menu` directly:
|
||||
|
||||
@@ -111,7 +111,7 @@ pub(super) fn font_items(english_names: bool) -> Vec<Item> {
|
||||
/// The catalogue's menu path of the effects in 3D and Materials › 3D (Classic).
|
||||
const CLASSIC_3D: &[&str] = &["Effect", "3D and Materials", "3D (Classic)"];
|
||||
|
||||
/// The raster effects' submenus of the Effect menu (the Photoshop-style effects, below the
|
||||
/// The raster effects' submenus of the Effect menu (the pixel effects, below the
|
||||
/// vector effects): (submenu, the catalogue's menu path of its effects).
|
||||
/// The raster Stylize submenu shares its path with the vector one and lists only the effects at
|
||||
/// that path that [`vectorcraft_effects::PIXEL_EFFECTS`] names.
|
||||
@@ -157,13 +157,13 @@ pub(super) fn effect_menu() -> Vec<Item> {
|
||||
"Warp",
|
||||
];
|
||||
let top_level = |e: &vectorcraft_effects::EffectInfo| e.menu == ["Effect"] && order.contains(&e.label);
|
||||
// An effect goes in the vector submenu its path names unless it is a Photoshop-style effect,
|
||||
// An effect goes in the vector submenu its path names unless it is a pixel effect,
|
||||
// which goes in the raster submenu of the same name when `RASTER_MENUS` has one (Stylize ›
|
||||
// Glowing Edges).
|
||||
let in_vector_menu =
|
||||
|e: &vectorcraft_effects::EffectInfo| order.iter().any(|s| e.menu == ["Effect", *s]) && !vectorcraft_effects::PIXEL_EFFECTS.contains(&e.id);
|
||||
let item = |e: &vectorcraft_effects::EffectInfo| match e.defaults.as_object().is_some_and(|o| o.is_empty()) {
|
||||
// No options (Effect → Pathfinder, Crop Marks): apply directly, like Illustrator.
|
||||
// No options (Effect → Pathfinder, Crop Marks): apply directly.
|
||||
true => Item::Cmd(e.label, "effect.apply", json!({ "effect": e.id })),
|
||||
false => Item::Cmd(e.label, "effect.dialog", json!({ "effect": e.id })),
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
|
||||
vec![
|
||||
(
|
||||
// The application menu: About and Discord only. The in-window bar never shows it (File
|
||||
// is first there, as in Illustrator); on macOS `native_menu::mac_layout` composes the
|
||||
// is first there); on macOS `native_menu::mac_layout` composes the
|
||||
// App menu from this entry and the other menus (About from Help, Settings from Edit,
|
||||
// Quit from File, Language and Appearance synthesized). It stays first: `from_tree`
|
||||
// gives the first menu the App role.
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
//! [`Backend`] (the desktop app's, through muda).
|
||||
//!
|
||||
//! Pure and platform-free, so it is tested everywhere and builds for the web; only the backend
|
||||
//! touches AppKit. What the layout does ([`mac_layout`], Illustrator on the Mac as the reference):
|
||||
//! touches AppKit. What the layout does ([`mac_layout`]):
|
||||
//! - an **app menu** named VectorCraft: About; Settings, a submenu with one item per Preferences
|
||||
//! page (General… ⌘K first); Language; Appearance (the UI brightness); Services; Hide VectorCraft
|
||||
//! ⌃⌘H (⌘H stays View › Hide Edges), Hide Others ⌥⌘H, Show All; and Quit ⌘Q, still the app's own
|
||||
//! `app.quit`, so documents with unsaved changes are asked about. Language and Appearance have
|
||||
//! no in-window menu (as in PhotoCraft) and are synthesized here; Quit is File › Exit in the
|
||||
//! no in-window menu and are synthesized here; Quit is File › Exit in the
|
||||
//! window and reads as Quit in the App menu. These leave the other menus (Edit › Preferences…,
|
||||
//! Help › About), and Join Our Discord stays under Help only;
|
||||
//! - **Window** gets Minimize ⌃⌘M, Zoom and Bring All to Front, and **Help** the system's search
|
||||
@@ -299,7 +299,7 @@ pub struct Layout {
|
||||
}
|
||||
|
||||
/// The Mac menu bar of `bar` (the in-window menus, [`from_tree`]): see the module docs.
|
||||
/// Language and Appearance have no in-window menu (as in PhotoCraft); when the tree doesn't
|
||||
/// Language and Appearance have no in-window menu; when the tree doesn't
|
||||
/// carry them they are synthesized below, so the App menu keeps them.
|
||||
pub fn mac_layout(app: &VectorcraftApp, bar: &MenuBar, lang: Lang) -> Layout {
|
||||
let mut bar = bar.clone();
|
||||
@@ -400,7 +400,7 @@ fn native_item(app: &VectorcraftApp, label: &'static str, command: &'static str,
|
||||
}
|
||||
|
||||
/// Settings ▸: one item per page of the Preferences dialog (its own list), each opening it there;
|
||||
/// the first (General…) has Preferences' shortcut (⌘K), as in Illustrator.
|
||||
/// the first (General…) has Preferences' shortcut (⌘K).
|
||||
fn settings_pages(preferences: &Item, lang: Lang) -> Vec<Node> {
|
||||
vectorcraft_engine::cmd::prefscmds::PREF_CATEGORIES
|
||||
.iter()
|
||||
|
||||
@@ -519,7 +519,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
Some(n) => stack(app, ui, n, sel, r, None),
|
||||
None => default_stack(app, ui),
|
||||
}
|
||||
// Spacer row like Illustrator's empty tail.
|
||||
// An empty spacer row at the end of the list.
|
||||
ui.allocate_exact_size(vec2(ui.available_width(), 10.0), Sense::hover());
|
||||
});
|
||||
bottom(app, ui, node.as_deref(), sel);
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::VectorcraftApp;
|
||||
use crate::theme::Tokens;
|
||||
use crate::widgets::{self, menu_item};
|
||||
|
||||
/// Colour values in the colour's own model, like Illustrator's Info panel.
|
||||
/// Color values in the color's own model, for the Info panel.
|
||||
pub fn color_values(c: &Color) -> Vec<(&'static str, String)> {
|
||||
match *c {
|
||||
Color::Rgb { r, g, b } => vec![("R", format!("{:.0}", r * 255.0)), ("G", format!("{:.0}", g * 255.0)), ("B", format!("{:.0}", b * 255.0))],
|
||||
|
||||
@@ -83,7 +83,7 @@ pub(super) fn bottom_bar(app: &mut VectorcraftApp, ui: &mut Ui, view: &View, doc
|
||||
actions.push(("layer.new".into(), json!({"top": m.command})));
|
||||
}
|
||||
}
|
||||
// Rows dropped on the trash are deleted, on New Layer duplicated, as in Illustrator. Both are
|
||||
// Rows dropped on the trash are deleted, on New Layer duplicated. Both are
|
||||
// outlined while rows (or, on the trash, a target circle) hang over them. Guide rows dropped on
|
||||
// the trash delete their guides (`guide.remove`); New Layer does not take them.
|
||||
for (button, cmd) in [(&trash, "ui.layerDelete"), (&new_layer, "layer.duplicate")] {
|
||||
|
||||
@@ -282,7 +282,7 @@ fn view_box(region: DRect, thumb: Rect, canvas: Rect, v: &crate::state::View, ui
|
||||
pts
|
||||
}
|
||||
|
||||
/// Slider position (0..1) ↔ zoom percent on Illustrator's log range 3.13 %–64 000 %.
|
||||
/// Slider position (0..1) ↔ zoom percent on a log range, 3.13 %–64 000 %.
|
||||
pub fn zoom_to_slider(z: f64) -> f64 {
|
||||
((z.clamp(3.13, 64000.0)).ln() - 3.13f64.ln()) / (64000f64.ln() - 3.13f64.ln())
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The Properties panel: context-sensitive sections like Illustrator's.
|
||||
//! The Properties panel: sections that change with the selection.
|
||||
|
||||
use egui::Ui;
|
||||
use serde_json::json;
|
||||
|
||||
@@ -76,7 +76,7 @@ fn dash_state(dash: Option<&Dash>, last: Option<(Vec<f64>, bool)>) -> (Vec<f64>,
|
||||
}
|
||||
|
||||
/// Six dash/gap fields → a dash pattern: stops at the first empty dash; a dash without a gap
|
||||
/// repeats its length as the gap (Illustrator's behaviour).
|
||||
/// repeats its length as the gap.
|
||||
pub fn dash_pattern(fields: &[Option<f64>; 6]) -> Vec<f64> {
|
||||
edited_dash_pattern(fields, &[])
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ pub fn paint_cursor(app: &mut VectorcraftApp, ctx: &egui::Context, painter: &egu
|
||||
// ---------- drops ----------
|
||||
|
||||
impl VectorcraftApp {
|
||||
/// Where file `name` dropped with the pointer at `pos` (screen points) goes: as in Illustrator,
|
||||
/// Where file `name` dropped with the pointer at `pos` (screen points) goes:
|
||||
/// onto the canvas of the open document (Shift embeds it), else opened. Where the platform
|
||||
/// doesn't say (`None`: desktop drags carry no position), a document opens as a tab of its
|
||||
/// own and a picture or text is placed in the middle of the view. A library, a presets file, a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Edit → Preferences (⌘K): Illustrator-style category list + fields, rendered from the engine's
|
||||
//! Edit → Preferences (⌘K): a category list + its fields, rendered from the engine's
|
||||
//! preference table ([`PREF_SPECS`]). The dialog edits a working copy in `Dialog::fields`
|
||||
//! (one field per preference key, so agents can `ui.dialog.set` any of them) and OK applies it
|
||||
//! through `prefs.set`. Also: persistence of engine prefs inside `UiState` and the per-frame
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Scrubbing numeric fields (#400, beyond Illustrator; Photoshop's scrubby labels): a horizontal
|
||||
//! Scrubbing numeric fields (#400): a horizontal
|
||||
//! drag on a numeric field's label (`W:`, `Opacity:`, the Character panel's size icon) steps the
|
||||
//! field's value by one unit every [`PX_PER_STEP`] points, ten with Shift and a tenth with
|
||||
//! Ctrl/Cmd, as the arrow keys step a focused field; a click on the label focuses the field. A
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn sync_zoom_stops_display_print_size(v: bool) {
|
||||
ZOOM_STOPS_PRINT_SIZE.store(v, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// Illustrator's preset zoom stops, in percent.
|
||||
/// The preset zoom stops, in percent.
|
||||
pub const ZOOM_STOPS: [f64; 26] = [
|
||||
3.13, 4.17, 6.25, 8.33, 12.5, 16.67, 25.0, 33.33, 50.0, 66.67, 100.0, 150.0, 200.0, 300.0, 400.0, 600.0, 800.0, 1200.0, 1600.0, 2400.0, 3200.0,
|
||||
4800.0, 6400.0, 12800.0, 25600.0, 64000.0,
|
||||
@@ -135,7 +135,7 @@ pub fn next_zoom_with_display(z: f64, up: bool, display_print_size: bool) -> f64
|
||||
zoom_from_display_percent(stop, display_print_size)
|
||||
}
|
||||
|
||||
/// Format like Illustrator's tab/zoom field: up to 2 decimals, no trailing zeros.
|
||||
/// Format for the tab/zoom field: up to 2 decimals, no trailing zeros.
|
||||
pub fn zoom_label(z: f64, display_print_size: bool) -> String {
|
||||
let s = format!("{:.2}", zoom_display_percent(z, display_print_size));
|
||||
let s = s.trim_end_matches('0').trim_end_matches('.');
|
||||
@@ -454,7 +454,7 @@ pub struct UiState {
|
||||
pub toolbar_advanced: bool,
|
||||
#[serde(default = "yes")]
|
||||
pub task_bar: bool,
|
||||
/// Where the Contextual Task Bar was dragged or pinned. Not saved, as in Illustrator: the bar
|
||||
/// Where the Contextual Task Bar was dragged or pinned. Not saved: the bar
|
||||
/// starts under the selection at every launch.
|
||||
#[serde(skip)]
|
||||
pub task_bar_place: TaskBarPlace,
|
||||
|
||||
@@ -12,7 +12,7 @@ pub enum Live {
|
||||
}
|
||||
|
||||
/// A colour slider with a gradient track (`track(t)` gives the colour at 0..1) and a triangular
|
||||
/// thumb below it, like Illustrator's Color panel. Returns the new normalized value and the phase.
|
||||
/// thumb below it, as in the Color panel. Returns the new normalized value and the phase.
|
||||
pub fn color_slider(ui: &mut Ui, id: impl std::hash::Hash, value: f32, width: f32, track: &dyn Fn(f32) -> Color32) -> (Option<f32>, Live) {
|
||||
color_slider_named(ui, id, "", value, width, track)
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ pub fn subheader(ui: &mut Ui, text: &str) {
|
||||
ui.label(egui::RichText::new(tl!(text)).size(12.5).color(t.text));
|
||||
}
|
||||
|
||||
/// A label drawn with a dotted underline (Illustrator's link labels: "Stroke:", "Opacity:").
|
||||
/// A label drawn with a dotted underline (the panels' link labels: "Stroke:", "Opacity:").
|
||||
pub fn link_label(ui: &mut Ui, text: &str) -> Response {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let galley = ui.painter().layout_no_wrap(tl!(text).to_string(), egui::FontId::proportional(12.5), t.text_strong);
|
||||
|
||||
@@ -293,8 +293,8 @@ pub(super) fn shown_alike(show: impl Fn(f64) -> String) -> impl Fn(f64, f64) ->
|
||||
/// goes to the next whole number in its direction (5.1 up to 6, down to 5), a Ctrl/Cmd step goes to
|
||||
/// the next tenth, and a Shift step adds or takes ten. Steps stop at the field's `bounds` (#3370:
|
||||
/// a weight stops at 0, a miter limit at 1), and a plain step also stops at each of `stops`
|
||||
/// ([`step_through`]). The new value is applied at once, as in
|
||||
/// Illustrator's panels and dialogs, and the new text replaces `buf`, all selected so typing
|
||||
/// ([`step_through`]). The new value is applied at once, and
|
||||
/// the new text replaces `buf`, all selected so typing
|
||||
/// replaces it when focused. Returns the new number when a step was taken. An enabled field takes
|
||||
/// the wheel without taking keyboard focus, and the panel under it doesn't scroll, when the wheel
|
||||
/// stream began over the field and the pointer was moved onto it, or pressed on it, after the
|
||||
@@ -745,7 +745,7 @@ impl egui::Plugin for WheelTailPlugin {
|
||||
|
||||
/// A [`num_field`] for a width or height (Transform panel, Properties panel, Control bar): Ctrl/Cmd+Enter
|
||||
/// also commits it and ends its editing, as Enter does, and [`enter_modifiers`] reports Command. A
|
||||
/// percentage typed alone (`50%`) is that share of the size shown, as in Illustrator (#2401).
|
||||
/// percentage typed alone (`50%`) is that share of the size shown (#2401).
|
||||
pub fn size_field(ui: &mut Ui, id: impl std::hash::Hash, value: Option<f64>, unit: Unit, width: f32) -> Option<f64> {
|
||||
size_field_named(ui, id, None, value, unit, width)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ pub const ESSENTIALS: &str = "Essentials";
|
||||
/// Touch workspace (Window → Workspace → Touch; Preferences › Devices › Enable Touch Workspace).
|
||||
pub const TOUCH: &str = "Touch";
|
||||
|
||||
/// Built-in workspaces, in Illustrator's menu order (Essentials first).
|
||||
/// Built-in workspaces, in menu order (Essentials first).
|
||||
pub fn builtins() -> Vec<Workspace> {
|
||||
let base = Workspace::default();
|
||||
let w = |name: &str, f: &dyn Fn(&mut Workspace)| {
|
||||
|
||||
Reference in New Issue
Block a user