mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
link map is kept centered on the active note box
This commit is contained in:
@@ -115,12 +115,16 @@ function createPanZoom(domElement, options) {
|
||||
zoomTo: publicZoomTo,
|
||||
zoomAbs: zoomAbs,
|
||||
smoothZoom: smoothZoom,
|
||||
getTransform: getTransformModel,
|
||||
showRectangle: showRectangle,
|
||||
|
||||
pause: pause,
|
||||
resume: resume,
|
||||
isPaused: isPaused,
|
||||
|
||||
getTransform: getTransformModel,
|
||||
getMinZoom: getMinZoom,
|
||||
getMaxZoom: getMaxZoom,
|
||||
getOwner: () => owner
|
||||
}
|
||||
|
||||
eventify(api);
|
||||
@@ -216,6 +220,14 @@ function createPanZoom(domElement, options) {
|
||||
return transform
|
||||
}
|
||||
|
||||
function getMinZoom() {
|
||||
return minZoom;
|
||||
}
|
||||
|
||||
function getMaxZoom() {
|
||||
return maxZoom;
|
||||
}
|
||||
|
||||
function getPoint() {
|
||||
return {
|
||||
x: transform.x,
|
||||
@@ -345,8 +357,14 @@ function createPanZoom(domElement, options) {
|
||||
transform.x = size.x - ratio * (size.x - transform.x)
|
||||
transform.y = size.y - ratio * (size.y - transform.y)
|
||||
|
||||
var transformAdjusted = keepTransformInsideBounds()
|
||||
if (!transformAdjusted) transform.scale *= ratio
|
||||
// TODO: https://github.com/anvaka/panzoom/issues/112
|
||||
if (bounds && boundsPadding === 1 && minZoom === 1) {
|
||||
transform.scale *= ratio
|
||||
keepTransformInsideBounds()
|
||||
} else {
|
||||
var transformAdjusted = keepTransformInsideBounds()
|
||||
if (!transformAdjusted) transform.scale *= ratio
|
||||
}
|
||||
|
||||
triggerEvent('zoom')
|
||||
|
||||
@@ -1308,7 +1326,7 @@ function makeAggregateRaf() {
|
||||
|
||||
var t = backBuffer;
|
||||
backBuffer = frontBuffer;
|
||||
frontBuffer = t;
|
||||
frontBuffer = t;
|
||||
|
||||
frontBuffer.forEach(function(callback) {
|
||||
callback();
|
||||
@@ -1571,7 +1589,7 @@ function removeWheelListener( elem, callback, useCapture ) {
|
||||
// unsubscription in some browsers. But in practice, I don't think we should
|
||||
// worry too much about it (those browsers are on the way out)
|
||||
function _addWheelListener( elem, eventName, callback, useCapture ) {
|
||||
elem[ _addEventListener ]( prefix + eventName, support == "wheel" ? callback : function(originalEvent ) {
|
||||
elem[ _addEventListener ]( prefix + eventName, support == "wheel" ? callback : function( originalEvent ) {
|
||||
!originalEvent && ( originalEvent = window.event );
|
||||
|
||||
// create a normalized event object
|
||||
@@ -1613,10 +1631,7 @@ function _addWheelListener( elem, eventName, callback, useCapture ) {
|
||||
// it's time to fire the callback
|
||||
return callback( event );
|
||||
|
||||
}, {
|
||||
capture: useCapture || false ,
|
||||
passive: false
|
||||
});
|
||||
}, useCapture || false );
|
||||
}
|
||||
|
||||
function _removeWheelListener( elem, eventName, callback, useCapture ) {
|
||||
|
||||
Reference in New Issue
Block a user