Skip to content

Commit

Permalink
cool#10630 doc electronic sign: fix outdated tile for shape move on 2…
Browse files Browse the repository at this point in the history
…nd page

Open a PDF with 2 pages, go to the second page, insert -> signature
line, drag the graphic selection, the shape doesn't show up at the new
location.

Seems this is really similar to the problem when inserting a signature
line doesn't invalidate properly.

There is still no precise tracking of invalidation for read-only &
multi-page PDF files, so just extract Control.Menubar.js code to a new
requestNewFiledBasedViewTiles() and use that in
ShapeHandlesSection.sendTransformCommand().

With this, visual esign for non-first pages is about as usable as for
first pages, finally.

Signed-off-by: Miklos Vajna <[email protected]>
Change-Id: Idbf0cfe32030471eb0472ff9a00ccc0304cc4cf3
  • Loading branch information
vmiklos authored and caolanm committed Jan 27, 2025
1 parent df5c0a6 commit 97d1664
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions browser/src/canvas/sections/ShapeHandlesSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ class ShapeHandlesSection extends CanvasSectionObject {
};

app.map.sendUnoCommand('.uno:TransformDialog', parameters);

docLayer.requestNewFiledBasedViewTiles();
}

onMouseUp(point: number[], e: MouseEvent): void {
Expand Down
11 changes: 4 additions & 7 deletions browser/src/control/Control.Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2029,13 +2029,10 @@ L.Control.Menubar = L.Control.extend({
app.map.sendUnoCommand('.uno:InsertSignatureLine');
}

if (app.file.fileBasedView) {
// The file based view is primarily to view multi-page PDF files, so
// it doesn't seem to have precise tracking of invalidations, just
// request new tiles for now.
app.map._docLayer._requestNewTiles();
app.map._docLayer.redraw();
}
// The file based view is primarily to view multi-page PDF files, so
// it doesn't seem to have precise tracking of invalidations, just
// request new tiles for now.
app.map._docLayer.requestNewFiledBasedViewTiles();
} else if (id === 'insertgraphic') {
L.DomUtil.get('insertgraphic').click();
} else if (id === 'insertgraphicremote') {
Expand Down
12 changes: 12 additions & 0 deletions browser/src/layer/tile/CanvasTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3106,6 +3106,18 @@ L.CanvasTileLayer = L.Layer.extend({
return verticalOffset;
},

// If viewing multi-page PDF files, no precise tracking of invalidations is implemented yet,
// so this allows requesting new tiles when we know a viewed PDF changes for some special
// reason.
requestNewFiledBasedViewTiles: function() {
if (!app.file.fileBasedView) {
return;
}

this._requestNewTiles();
this.redraw();
},

// Given a character code and a UNO keycode, send a "key" message to coolwsd.
//
// "type" is either "input" for key presses (akin to the DOM "keypress"
Expand Down

0 comments on commit 97d1664

Please sign in to comment.