add functions for triggering layout and unselect annotations
Instead of checking if specific functions exist for layouting and unselecting of annotation, add functions that always exist on the TileLayer with the ability to override in the specific subclass. Change-Id: I3be24bf58fef0e09dfee10f80b1b888ce0e0f1f8 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99020 Tested-by: Jenkins Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
1fb8e24754
commit
3ebb0b9058
7 changed files with 39 additions and 5 deletions
|
@ -167,9 +167,7 @@ L.Control.Scroll = L.Control.extend({
|
|||
// Scrolling quickly via mousewheel messes up the annotations for some reason
|
||||
// Triggering the layouting algorithm here, though unnecessary, fixes the problem.
|
||||
// This is just a workaround till we find the root cause of why it messes up the annotations
|
||||
if (this._map._docLayer._annotations && this._map._docLayer._annotations.layout) {
|
||||
this._map._docLayer._annotations.layout();
|
||||
}
|
||||
this._map._docLayer.layoutAnnotations();
|
||||
},
|
||||
|
||||
_onScrollTo: function (e) {
|
||||
|
|
|
@ -85,6 +85,10 @@ L.AnnotationManagerImpress = L.AnnotationManagerBase.extend({
|
|||
this._map._docLayer._updateMaxBounds(true, extraSize);
|
||||
}
|
||||
},
|
||||
unselectAnnotations: function() {
|
||||
this._selection = null;
|
||||
this.onAnnotationCancel();
|
||||
},
|
||||
_onAnnotationZoom: function () {
|
||||
this.onAnnotationCancel();
|
||||
},
|
||||
|
|
|
@ -68,6 +68,12 @@ L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({
|
|||
this._annotations = {};
|
||||
},
|
||||
|
||||
layoutAnnotations: function () {
|
||||
},
|
||||
|
||||
unselectAnnotations: function () {
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
map.addControl(L.control.tabs());
|
||||
map.addControl(L.control.columnHeader());
|
||||
|
|
|
@ -136,6 +136,14 @@ L.ImpressTileLayer = L.TileLayer.extend({
|
|||
this._annotationManager.clearAnnotations();
|
||||
},
|
||||
|
||||
layoutAnnotations: function () {
|
||||
this._annotationManager.layoutAnnotations();
|
||||
},
|
||||
|
||||
unselectAnnotations: function () {
|
||||
this._annotationManager.unselectAnnotations();
|
||||
},
|
||||
|
||||
removeAnnotation: function (id) {
|
||||
this._annotationManager.removeAnnotation(id);
|
||||
},
|
||||
|
|
|
@ -463,6 +463,14 @@ L.TileLayer = L.GridLayer.extend({
|
|||
console.debug('Implemented in child classes');
|
||||
},
|
||||
|
||||
layoutAnnotations: function () {
|
||||
console.debug('Implemented in child classes');
|
||||
},
|
||||
|
||||
unselectAnnotations: function () {
|
||||
console.debug('Implemented in child classes');
|
||||
},
|
||||
|
||||
getEvents: function () {
|
||||
var events = {
|
||||
viewreset: this._viewReset,
|
||||
|
|
|
@ -58,6 +58,16 @@ L.WriterTileLayer = L.TileLayer.extend({
|
|||
}
|
||||
},
|
||||
|
||||
layoutAnnotations: function () {
|
||||
this._annotations.layout();
|
||||
},
|
||||
|
||||
unselectAnnotations: function () {
|
||||
if (this._annotations) {
|
||||
this._annotations.unselect();
|
||||
}
|
||||
},
|
||||
|
||||
onAnnotationRemove: function (id) {
|
||||
this._annotations.remove(id);
|
||||
},
|
||||
|
|
|
@ -1560,8 +1560,8 @@ L.Map = L.Evented.extend({
|
|||
}
|
||||
|
||||
// unselect if anything is selected already
|
||||
if (this._docLayer && this._docLayer._annotations && this._docLayer._annotations.unselect) {
|
||||
this._docLayer._annotations.unselect();
|
||||
if (this._docLayer) {
|
||||
this._docLayer.unselectAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue