Skip to content

Commit ed8b31c

Browse files
fire 'importannotations' on comments import and add listener in ViewLayoutWriter
ViewLayoutWriter listens for zoom, resize and annotation events and based on that centers the document if there are any comments and a possibility of bringing them into the view by adjusting margins. but if the window is just wide enough to show the comments and the document, and we reload the document, the resize event doesn't find any comments (as they haven't been imported by then). thus the comments are half visible/ cut-off. this isn't noticable when the sidebar is not collapsed as the sidebar appears after the comments have been imported and it invalidates the view which fires 'resize' which ViewLayoutWriter listens for. here we fire an event 'importannotations' after importing the comments in writer and then the document adjusts it's horizontal position to bring comments into the view. Signed-off-by: Sahil Gautam <[email protected]> Change-Id: Ice393ec507de6a1b79fc7cd4aa0bb21abf447ee2
1 parent 31c4756 commit ed8b31c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

browser/src/app/ViewLayoutWriter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ViewLayoutWriter extends ViewLayoutBase {
2424
app.map.on('resize', this.documentZoomOrResizeCallback, this);
2525
app.map.on('deleteannotation', this.annotationOperationsCallback, this);
2626
app.map.on('insertannotation', this.annotationOperationsCallback, this);
27+
app.map.on('importannotations', this.annotationOperationsCallback, this);
2728
app.map.on(
2829
'showannotationschanged',
2930
this.annotationOperationsCallback,

browser/src/layer/tile/WriterTileLayer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ window.L.WriterTileLayer = window.L.CanvasTileLayer.extend({
5151
comment.parent = comment.parentId.toString();
5252
});
5353
app.sectionContainer.getSectionWithName(app.CSections.CommentList.name).importComments(values.comments);
54+
app.map.fire('importannotations');
5455
}
5556
else if (values.redlines && values.redlines.length > 0) {
5657
app.sectionContainer.getSectionWithName(app.CSections.CommentList.name).importChanges(values.redlines);

0 commit comments

Comments
 (0)