mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[Editor] Add some resizers all around an editor (bug 1843302)
- it'll improve the way to resize images: diagonally (in keeping ratio between dimensions) or horizontally/vertically. - the resizer was almost invisible in HCM. - make a resize undoable/redoable.
This commit is contained in:
parent
71f113bf85
commit
2688bf2ebd
6 changed files with 452 additions and 41 deletions
|
@ -79,6 +79,7 @@ class InkEditor extends AnnotationEditor {
|
|||
this.translationX = this.translationY = 0;
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this._willKeepAspectRatio = true;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
@ -156,6 +157,11 @@ class InkEditor extends AnnotationEditor {
|
|||
];
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
get resizeType() {
|
||||
return AnnotationEditorParamsType.INK_DIMS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the thickness and make this action undoable.
|
||||
* @param {number} thickness
|
||||
|
@ -619,6 +625,7 @@ class InkEditor extends AnnotationEditor {
|
|||
this.div.classList.add("disabled");
|
||||
|
||||
this.#fitToContent(/* firstTime = */ true);
|
||||
this.makeResizable();
|
||||
|
||||
this.parent.addInkEditorIfNeeded(/* isCommitting = */ true);
|
||||
|
||||
|
@ -754,6 +761,11 @@ class InkEditor extends AnnotationEditor {
|
|||
this.#observer.observe(this.div);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
get isResizable() {
|
||||
return !this.isEmpty() && this.#disableEditing;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
render() {
|
||||
if (this.div) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue