parent
8b1840d633
commit
e3266af25b
|
@ -2,6 +2,7 @@ var mousewheel = require('./mousewheel');
|
|||
|
||||
var bpmnModule = require('../../di').defaultModule;
|
||||
|
||||
|
||||
function ZoomScroll(events, canvas) {
|
||||
|
||||
var RANGE = { min: 0.2, max: 4 };
|
||||
|
@ -13,6 +14,10 @@ function ZoomScroll(events, canvas) {
|
|||
return Math.max(RANGE.min, Math.min(RANGE.max, scale));
|
||||
}
|
||||
|
||||
function reset() {
|
||||
canvas.zoom('fit-viewport');
|
||||
}
|
||||
|
||||
function zoom(direction, position) {
|
||||
|
||||
var currentZoom = canvas.zoom();
|
||||
|
@ -22,7 +27,7 @@ function ZoomScroll(events, canvas) {
|
|||
}
|
||||
|
||||
|
||||
function initMouseWheel(element) {
|
||||
function init(element) {
|
||||
|
||||
mousewheel(element).on('mousewheel', function(event) {
|
||||
|
||||
|
@ -51,11 +56,12 @@ function ZoomScroll(events, canvas) {
|
|||
}
|
||||
|
||||
events.on('canvas.init', function(e) {
|
||||
initMouseWheel(e.paper.node);
|
||||
init(e.paper.node);
|
||||
});
|
||||
|
||||
// API
|
||||
this.zoom = zoom;
|
||||
this.reset = reset;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue