1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

[Editor] Add a new base class to allow to add a drawing in the SVG layer.

This patch makes a clear separation between the way to draw and the editing stuff.
It adds a class DrawEditor which should be extended in order to create new drawing tools.
As an example, the ink tool has been rewritten in order to use it.
This commit is contained in:
Calixte Denizet 2024-11-20 22:26:38 +01:00
parent 22babd722f
commit cee65fcd4e
17 changed files with 2560 additions and 1377 deletions

View file

@ -66,20 +66,22 @@
font-size: 0;
}
.textLayer.highlighting {
cursor: var(--editorFreeHighlight-editing-cursor);
.textLayer {
&.highlighting {
cursor: var(--editorFreeHighlight-editing-cursor);
&:not(.free) span {
cursor: var(--editorHighlight-editing-cursor);
&:not(.free) span {
cursor: var(--editorHighlight-editing-cursor);
&[role="img"] {
&[role="img"] {
cursor: var(--editorFreeHighlight-editing-cursor);
}
}
&.free span {
cursor: var(--editorFreeHighlight-editing-cursor);
}
}
&.free span {
cursor: var(--editorFreeHighlight-editing-cursor);
}
}
#viewerContainer.pdfPresentationMode:fullscreen,
@ -154,6 +156,11 @@
.annotationEditorLayer.inkEditing {
cursor: var(--editorInk-editing-cursor);
touch-action: none;
}
.annotationEditorLayer .draw {
box-sizing: border-box;
}
.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) {

View file

@ -17,6 +17,10 @@
svg {
transform: none;
&.moving {
z-index: 100000;
}
&.highlight,
&.highlightOutline {
&[data-main-rotation="90"] {
@ -41,6 +45,23 @@
}
}
&.draw {
position: absolute;
mix-blend-mode: normal;
&[data-draw-rotation="90"] {
transform: rotate(90deg);
}
&[data-draw-rotation="180"] {
transform: rotate(180deg);
}
&[data-draw-rotation="270"] {
transform: rotate(270deg);
}
}
&.highlight {
--blend-mode: multiply;

View file

@ -300,7 +300,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</div>
<div class="editorParamsSetter">
<label for="editorInkOpacity" class="editorParamsLabel" data-l10n-id="pdfjs-editor-ink-opacity-input">Opacity</label>
<input type="range" id="editorInkOpacity" class="editorParamsSlider" value="100" min="1" max="100" step="1" tabindex="0">
<input type="range" id="editorInkOpacity" class="editorParamsSlider" value="1" min="0.05" max="1" step="0.05" tabindex="0">
</div>
</div>
</div>