2018-05-16 00:53:27 +00:00
|
|
|
/* globals svgEditor, svgCanvas */
|
2013-02-07 13:57:55 +00:00
|
|
|
/*
|
|
|
|
* ext-panning.js
|
|
|
|
*
|
|
|
|
* Licensed under the MIT License
|
|
|
|
*
|
2013-02-07 14:00:11 +00:00
|
|
|
* Copyright(c) 2013 Luis Aguirre
|
2013-02-07 13:57:55 +00:00
|
|
|
*
|
|
|
|
*/
|
2018-05-16 00:53:27 +00:00
|
|
|
|
|
|
|
/*
|
2013-02-07 14:00:11 +00:00
|
|
|
This is a very basic SVG-Edit extension to let tablet/mobile devices panning without problem
|
2013-02-07 13:57:55 +00:00
|
|
|
*/
|
|
|
|
|
2018-05-16 00:53:27 +00:00
|
|
|
svgEditor.addExtension('ext-panning', function () {
|
|
|
|
'use strict';
|
2013-02-16 11:21:06 +00:00
|
|
|
return {
|
|
|
|
name: 'Extension Panning',
|
2014-02-12 03:48:48 +00:00
|
|
|
svgicons: svgEditor.curConfig.extPath + 'ext-panning.xml',
|
2013-02-16 11:21:06 +00:00
|
|
|
buttons: [{
|
|
|
|
id: 'ext-panning',
|
|
|
|
type: 'mode',
|
|
|
|
title: 'Panning',
|
|
|
|
events: {
|
2018-05-16 00:53:27 +00:00
|
|
|
click: function () {
|
2013-02-16 11:21:06 +00:00
|
|
|
svgCanvas.setMode('ext-panning');
|
2013-02-07 13:57:55 +00:00
|
|
|
}
|
|
|
|
}
|
2013-02-16 11:21:06 +00:00
|
|
|
}],
|
2018-05-16 00:53:27 +00:00
|
|
|
mouseDown: function () {
|
|
|
|
if (svgCanvas.getMode() === 'ext-panning') {
|
2013-02-16 11:21:06 +00:00
|
|
|
svgEditor.setPanning(true);
|
|
|
|
return {started: true};
|
|
|
|
}
|
|
|
|
},
|
2018-05-16 00:53:27 +00:00
|
|
|
mouseUp: function () {
|
|
|
|
if (svgCanvas.getMode() === 'ext-panning') {
|
2013-02-16 11:21:06 +00:00
|
|
|
svgEditor.setPanning(false);
|
|
|
|
return {
|
|
|
|
keep: false,
|
|
|
|
element: null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2013-02-07 13:57:55 +00:00
|
|
|
});
|