mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-11-30 16:37:18 +01:00
Share editor layout and resizer styles with the desktop viewer. Add grey borders, square resizers and a close button, and include the button when constraining editor positions.
206 lines
4.5 KiB
CSS
206 lines
4.5 KiB
CSS
/* 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.
|
|
*/
|
|
|
|
/* Shared editor layout; each viewer defines its outline and resizer variables. */
|
|
|
|
@import url(draw_layer_builder.css);
|
|
|
|
:root {
|
|
--editor-selection-outline: solid var(--outline-width) var(--outline-color);
|
|
--unfocus-outline: solid var(--outline-width) transparent;
|
|
--focus-outline-around: solid var(--outline-around-width)
|
|
var(--outline-around-color);
|
|
--hover-outline: solid var(--outline-width) var(--hover-outline-color);
|
|
--hover-outline-around: solid var(--outline-around-width)
|
|
var(--hover-outline-around-color);
|
|
--resizer-shift: calc(
|
|
0px - (var(--outline-width) + var(--resizer-size)) / 2 -
|
|
var(--outline-around-width)
|
|
);
|
|
}
|
|
|
|
.page:has(.annotationEditorLayer.nonEditing)
|
|
.annotationLayer
|
|
.editorAnnotation {
|
|
position: absolute;
|
|
pointer-events: none;
|
|
}
|
|
|
|
[data-editor-rotation="90"] {
|
|
transform: rotate(90deg);
|
|
}
|
|
|
|
[data-editor-rotation="180"] {
|
|
transform: rotate(180deg);
|
|
}
|
|
|
|
[data-editor-rotation="270"] {
|
|
transform: rotate(270deg);
|
|
}
|
|
|
|
.annotationEditorLayer {
|
|
background: transparent;
|
|
position: absolute;
|
|
inset: 0;
|
|
font-size: calc(100px * var(--total-scale-factor));
|
|
transform-origin: 0 0;
|
|
cursor: auto;
|
|
|
|
.selectedEditor {
|
|
z-index: 100000 !important;
|
|
}
|
|
|
|
&.drawing * {
|
|
pointer-events: none !important;
|
|
}
|
|
|
|
&.getElements {
|
|
pointer-events: auto !important;
|
|
> div {
|
|
pointer-events: auto !important;
|
|
}
|
|
}
|
|
}
|
|
|
|
.annotationEditorLayer.waiting {
|
|
content: "";
|
|
cursor: wait;
|
|
position: absolute;
|
|
inset: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.annotationEditorLayer.disabled {
|
|
pointer-events: none;
|
|
|
|
&.highlightEditing
|
|
:is(
|
|
.freeTextEditor,
|
|
.inkEditor,
|
|
.stampEditor,
|
|
.signatureEditor,
|
|
.commentPopup
|
|
) {
|
|
pointer-events: auto;
|
|
}
|
|
}
|
|
|
|
.annotationEditorLayer .draw {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.annotationEditorLayer
|
|
:is(.freeTextEditor, .inkEditor, .stampEditor, .signatureEditor) {
|
|
position: absolute;
|
|
background: transparent;
|
|
z-index: 1;
|
|
transform-origin: 0 0;
|
|
cursor: auto;
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
border: var(--unfocus-outline);
|
|
|
|
&.draggable.selectedEditor {
|
|
cursor: move;
|
|
}
|
|
|
|
&.selectedEditor {
|
|
border: var(--editor-selection-outline);
|
|
outline: var(--focus-outline-around);
|
|
|
|
&::before {
|
|
/* Add the inner outline. Editor positioning accounts for the element's
|
|
border in AnnotationEditor.getBaseTranslation(). */
|
|
content: "";
|
|
position: absolute;
|
|
inset: 0;
|
|
border: var(--focus-outline-around);
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
|
|
&:hover:not(.selectedEditor) {
|
|
border: var(--hover-outline);
|
|
outline: var(--hover-outline-around);
|
|
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
inset: 0;
|
|
border: var(--focus-outline-around);
|
|
}
|
|
}
|
|
|
|
& > .resizers {
|
|
position: absolute;
|
|
inset: 0;
|
|
z-index: 1;
|
|
|
|
&.hidden {
|
|
display: none;
|
|
}
|
|
|
|
& > .resizer {
|
|
width: var(--resizer-size);
|
|
height: var(--resizer-size);
|
|
background: content-box var(--resizer-bg-color);
|
|
border: var(--focus-outline-around);
|
|
border-radius: var(--resizer-border-radius);
|
|
position: absolute;
|
|
|
|
&.topLeft {
|
|
top: var(--resizer-shift);
|
|
left: var(--resizer-shift);
|
|
}
|
|
|
|
&.topMiddle {
|
|
top: var(--resizer-shift);
|
|
left: calc(50% + var(--resizer-shift));
|
|
}
|
|
|
|
&.topRight {
|
|
top: var(--resizer-shift);
|
|
right: var(--resizer-shift);
|
|
}
|
|
|
|
&.middleRight {
|
|
top: calc(50% + var(--resizer-shift));
|
|
right: var(--resizer-shift);
|
|
}
|
|
|
|
&.bottomRight {
|
|
bottom: var(--resizer-shift);
|
|
right: var(--resizer-shift);
|
|
}
|
|
|
|
&.bottomMiddle {
|
|
bottom: var(--resizer-shift);
|
|
left: calc(50% + var(--resizer-shift));
|
|
}
|
|
|
|
&.bottomLeft {
|
|
bottom: var(--resizer-shift);
|
|
left: var(--resizer-shift);
|
|
}
|
|
|
|
&.middleLeft {
|
|
top: calc(50% + var(--resizer-shift));
|
|
left: var(--resizer-shift);
|
|
}
|
|
}
|
|
}
|
|
}
|