Files
svgedit/editor/extensions/ext-panning.js
Luis Aguirre 9041ef9609 Fixed: ext-panning removes last created element
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2338 eee81c28-f429-11dd-99c0-75d572ba1ddd
2013-02-07 18:12:36 +00:00

49 lines
887 B
JavaScript

/*
* ext-panning.js
*
* Licensed under the MIT License
*
* Copyright(c) 2013 Luis Aguirre
*
*/
/*
This is a very basic SVG-Edit extension to let tablet/mobile devices panning without problem
*/
svgEditor.addExtension("ext-panning", function() {
return {
name: "Extension Panning",
svgicons: "extensions/ext-panning.xml",
buttons: [{
id: "ext-panning",
type: "mode",
title: "Panning",
events: {
'click': function() {
svgCanvas.setMode("ext-panning");
}
}
}],
mouseDown: function() {
if(svgCanvas.getMode() == "ext-panning") {
svgEditor.setPanning(true);
return {started: true};
}
},
mouseUp: function(opts) {
if(svgCanvas.getMode() == "ext-panning") {
svgEditor.setPanning(false);
return {
keep: false,
element: null
}
}
}
};
});