Send the new position of the annotation when the marker is moved
Change-Id: I5a81feb8308808e9221ed7f7f29ea7758d91c309 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97410 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
edaea8a389
commit
8b133a76d3
1 changed files with 27 additions and 0 deletions
|
@ -473,6 +473,33 @@ L.Annotation = L.Layer.extend({
|
|||
this._map._docLayer._twipsToLatLng(topLeftTwips, this._map.getZoom()),
|
||||
this._map._docLayer._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
|
||||
this._annotationMarker.setLatLng(bounds.getSouthWest());
|
||||
this._annotationMarker.on('dragstart drag dragend', this._onMarkerDrag, this);
|
||||
},
|
||||
_onMarkerDrag: function(event) {
|
||||
if (this._annotationMarker == null)
|
||||
return;
|
||||
if (event.type === 'dragend') {
|
||||
var rect = this._annotationMarker._icon.getBoundingClientRect();
|
||||
var pointTwip = this._map._docLayer._pixelsToTwips({x: rect.left, y: rect.top});
|
||||
this._sendAnnotationPositionChange(pointTwip);
|
||||
}
|
||||
},
|
||||
_sendAnnotationPositionChange: function(newPosition) {
|
||||
var comment = {
|
||||
Id: {
|
||||
type: 'string',
|
||||
value: this._data.id
|
||||
},
|
||||
PositionX: {
|
||||
type: 'int32',
|
||||
value: newPosition.x
|
||||
},
|
||||
PositionY: {
|
||||
type: 'int32',
|
||||
value: newPosition.y
|
||||
}
|
||||
};
|
||||
this._map.sendUnoCommand('.uno:EditAnnotation', comment);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue