Fixed centering of icons. Disabled zooming in/out on Windows. Added default icons

This commit is contained in:
Lam Wei Lun
2026-09-16 12:15:27 +08:00
parent 435336a3cf
commit f76e4b1e02
7 changed files with 76 additions and 37 deletions
+13 -5
View File
@@ -294,13 +294,21 @@ function actionIcon(a) {
return (a && a.icon) ? a.icon : "";
}
// Put a pictogram into a tile (search row, favourites tile, or tab row). No icon leaves the tile
// blank. `mono` marks the white tab-strip glyphs, which the CSS recolors to the shared gray.
// Pictogram shown when an action carries none (plugins, icon-less commands/settings). A dedicated
// theme-neutral glyph (resources/images/action_default.svg: frame + ">_" prompt), so no tile is
// blank and no existing action's icon is borrowed.
var DEFAULT_ICON = "action_default";
// SVG base name a tile actually renders: the action's own icon, else the placeholder. Pure.
function tileIcon(a) {
return actionIcon(a) || DEFAULT_ICON;
}
// Put a pictogram into a tile (search row, favourites tile, or tab row). `mono` marks the white
// tab-strip glyphs, which the CSS recolors to the shared gray.
function fillTile(tile, a, mono) {
tile.textContent = "";
var icon = actionIcon(a);
if (!icon)
return;
var icon = tileIcon(a);
var img = document.createElement("img");
img.className = mono ? "tile-icon tab-mono" : "tile-icon";
img.src = ICON_BASE + icon + ".svg";
@@ -281,6 +281,17 @@ assert.equal(ctx.actionIcon({ id: "x", title: "Plugin action" }), "",
assert.equal(ctx.actionIcon(null), "",
"a null action (tab row) renders a blank tile");
// tileIcon: the base name a tile renders - the action's own icon when present, else the placeholder.
assert.equal(ctx.tileIcon({ id: "x", title: "Slice", icon: "media_play" }), "media_play",
"an action with an icon keeps it");
assert.equal(ctx.tileIcon({ id: "x", title: "Go to tab...", icon: "" }), "action_default",
"an empty icon falls back to the placeholder");
assert.equal(ctx.tileIcon({ id: "x", title: "Plugin action" }), "action_default",
"a missing icon falls back to the placeholder");
assert.equal(ctx.DEFAULT_ICON, "action_default", "the placeholder is the dedicated default glyph");
assert.ok(fs.existsSync(__dirname + "/../../../images/action_default.svg"),
"the placeholder SVG ships alongside the page's other icons");
// needsModeSwitch: a setting is gated only when its required mode outranks the user's current mode.
assert.equal(ctx.needsModeSwitch({ mode: "advanced" }, "simple"), true, "Advanced is gated in Simple mode");
assert.equal(ctx.needsModeSwitch({ mode: "expert" }, "simple"), true, "Expert is gated in Simple mode");
+4 -1
View File
@@ -331,12 +331,15 @@ body {
border: 1px solid var(--speed-tile-border, #d8d8d8);
}
/* Native SVG pictogram in a tile; blank tiles (no icon) have no child. */
/* Native SVG pictogram in a tile. The Orca icon grid draws 1px strokes from 0.5..14.5 of the 16
viewBox, so the visible glyph is 0..15 and, centered as-is, leaves one extra pixel on the right/
bottom (the "Save Project leans left" look). Shift by half a pixel to center the visible artwork. */
.tile-icon {
width: 16px;
height: 16px;
display: block;
pointer-events: none;
transform: translate(.5px, .5px);
}
/* Tab-strip glyphs are drawn white for the dark tab bar; recolor to the shared #949494 gray so