mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
[Editor] Correctly update the current drawing when zooming
We were trying to update the drawing on the current page but if the drawing is an another page then it wasn't updated.
This commit is contained in:
parent
9cbc5baafd
commit
dfa0e79553
3 changed files with 83 additions and 6 deletions
|
@ -804,7 +804,7 @@ class AnnotationEditorLayer {
|
|||
return;
|
||||
}
|
||||
|
||||
this.#uiManager.unselectAll();
|
||||
this.#uiManager.setCurrentDrawingSession(this);
|
||||
this.#drawingAC = new AbortController();
|
||||
const signal = this.#uiManager.combinedSignal(this.#drawingAC);
|
||||
this.div.addEventListener(
|
||||
|
@ -816,7 +816,6 @@ class AnnotationEditorLayer {
|
|||
},
|
||||
{ signal }
|
||||
);
|
||||
this.#uiManager.disableUserSelect(true);
|
||||
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
||||
}
|
||||
|
||||
|
@ -824,9 +823,9 @@ class AnnotationEditorLayer {
|
|||
if (!this.#drawingAC) {
|
||||
return null;
|
||||
}
|
||||
this.#uiManager.setCurrentDrawingSession(null);
|
||||
this.#drawingAC.abort();
|
||||
this.#drawingAC = null;
|
||||
this.#uiManager.disableUserSelect(false);
|
||||
return this.#currentEditorType.endDrawing(isAborted);
|
||||
}
|
||||
|
||||
|
|
|
@ -610,6 +610,8 @@ class AnnotationEditorUIManager {
|
|||
|
||||
#copyPasteAC = null;
|
||||
|
||||
#currentDrawingSession = null;
|
||||
|
||||
#currentPageIndex = 0;
|
||||
|
||||
#deletedAnnotationsElementIds = new Set();
|
||||
|
@ -972,6 +974,20 @@ class AnnotationEditorUIManager {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current drawing session.
|
||||
* @param {AnnotationEditorLayer} layer
|
||||
*/
|
||||
setCurrentDrawingSession(layer) {
|
||||
if (layer) {
|
||||
this.unselectAll();
|
||||
this.disableUserSelect(true);
|
||||
} else {
|
||||
this.disableUserSelect(false);
|
||||
}
|
||||
this.#currentDrawingSession = layer;
|
||||
}
|
||||
|
||||
setMainHighlightColorPicker(colorPicker) {
|
||||
this.#mainHighlightColorPicker = colorPicker;
|
||||
}
|
||||
|
@ -1054,7 +1070,7 @@ class AnnotationEditorUIManager {
|
|||
for (const editor of this.#editorsToRescale) {
|
||||
editor.onScaleChanging();
|
||||
}
|
||||
this.currentLayer?.onScaleChanging();
|
||||
this.#currentDrawingSession?.onScaleChanging();
|
||||
}
|
||||
|
||||
onRotationChanging({ pagesRotation }) {
|
||||
|
@ -1984,7 +2000,7 @@ class AnnotationEditorUIManager {
|
|||
* @param {AnnotationEditor} editor
|
||||
*/
|
||||
setSelected(editor) {
|
||||
this.currentLayer?.commitOrRemove();
|
||||
this.#currentDrawingSession?.commitOrRemove();
|
||||
for (const ed of this.#selectedEditors) {
|
||||
if (ed !== editor) {
|
||||
ed.unselect();
|
||||
|
@ -2176,7 +2192,7 @@ class AnnotationEditorUIManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.currentLayer?.commitOrRemove()) {
|
||||
if (this.#currentDrawingSession?.commitOrRemove()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue