Files
Calixte Denizet 34246a0b6f Zoom the text layer with CSS and only set a transform on the spans which need one
The span font sizes are in page units and the transform is only set when the
span is rotated, skewed or scaled, which makes the layout cheaper.
The free highlight box comes from the editor layer: with the pre-standard CSS
zoom (Chrome < 128, Safari 18), the zoomed text layer client rect is scaled.
2026-11-30 13:45:33 +01:00

247 lines
5.1 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Copyright 2026 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#debug-view {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
gap: 10px;
&[hidden] {
display: none;
}
}
#render-panels {
flex: 1;
min-width: 0;
min-height: 0;
align-items: stretch;
--spc-resizer-color: var(--border-color);
--spc-resizer-hover-color: var(--accent-color);
}
#render-panels {
/* instructionsSplit (spc-column) takes half the width next to canvas. */
> .spc-column {
flex: 1 1 0;
}
/* canvasFontSplit (spc-row) takes the other half. */
> .spc-row {
flex: 1 1 0;
}
/* opTopSplit (spc-row) takes 70% of the instructions column height. */
> .spc-column > .spc-row {
flex: 7 1 0;
}
}
#gfx-state-panel {
flex: 3 1 0;
min-width: 20ch;
overflow: auto;
min-height: 0;
padding-block: 8px;
background: var(--surface-bg);
border-radius: 4px;
border: 1px solid var(--border-color);
}
#canvas-panel {
flex: 1 1 0;
display: flex;
flex-direction: column;
min-width: 0;
background: var(--surface-bg);
border-radius: 4px;
border: 1px solid var(--border-color);
}
#canvas-toolbar {
--btn-h: calc(
1.1em * 1.4 + 4px
); /* font-size * line-height + 2×(padding+border) */
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 4px 8px;
border-bottom: 1px solid var(--border-color);
button {
box-sizing: border-box;
height: var(--btn-h);
padding: 0 8px;
border-radius: 3px;
border: 1px solid var(--input-border-color);
background: var(--button-bg);
color: inherit;
cursor: pointer;
font-family: inherit;
font-size: 1.1em;
line-height: 1.4;
&:hover {
background: var(--button-hover-bg);
}
&:disabled {
opacity: 0.4;
cursor: default;
}
&[aria-pressed="true"] {
background: var(--accent-color);
color: var(--accent-fg, white);
border-color: var(--accent-color);
&:hover {
background: color-mix(
in srgb,
var(--accent-color),
var(--accent-fg, white) 15%
);
}
}
}
.toolbar-left:not(:has(#text-filter-button[aria-pressed="true"])) {
#text-layer-color-button,
#text-span-border-button,
#font-view-button {
display: none;
}
}
#text-span-border-button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0;
width: var(--btn-h);
}
#text-layer-color-button {
padding: 3px;
width: var(--btn-h);
#text-layer-color-swatch {
display: block;
width: 100%;
height: 100%;
border-radius: 2px;
background: var(--text-layer-color, #c03030);
}
}
.toolbar-left,
.toolbar-right {
flex: 1;
display: flex;
align-items: center;
gap: 6px;
}
.toolbar-right {
justify-content: flex-end;
}
.toolbar-center {
display: flex;
align-items: center;
gap: 6px;
}
#zoom-level {
min-width: 4ch;
text-align: center;
}
}
#canvas-scroll {
flex: 1;
overflow: auto;
padding: 8px 12px;
min-height: 0;
background: var(--clr-canvas-bg);
display: flex;
flex-direction: column;
align-items: safe center;
gap: 12px;
}
#canvas-wrapper {
--scale-round-x: 1px;
--scale-round-y: 1px;
position: relative;
display: inline-block;
line-height: 0;
/* Make text-layer spans visible in the debugger (normally transparent). */
.textLayer :is(span, br) {
color: color-mix(
in srgb,
var(--text-layer-color, #c03030) 70%,
transparent
);
}
.textLayer .font-highlighted {
background: color-mix(
in srgb,
var(--font-highlight-color, #0070c1) 25%,
transparent
);
}
&.show-span-borders .textLayer :is(span, br) {
outline: var(--text-layer-screen-px, 1px) solid
color-mix(in srgb, var(--text-layer-color, #c03030) 60%, black);
}
}
.temp-canvas-wrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 4px;
cursor: pointer;
}
.temp-canvas-label {
font-size: 0.85em;
color: var(--muted-color);
font-style: italic;
}
.canvas-checker {
display: inline-block;
line-height: 0;
background-image: conic-gradient(
light-dark(#cfcfd8, #42414d) 25%,
light-dark(white, #8f8f9d) 25% 50%,
light-dark(#cfcfd8, #42414d) 50% 75%,
light-dark(white, #8f8f9d) 75%
);
background-size: 30px 30px;
}
.temp-canvas-wrapper .canvas-checker {
border: 1px solid var(--border-subtle-color);
zoom: calc(1 / var(--dpr, 1));
}
#render-canvas {
cursor: pointer;
}
#highlight-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}