Removing comments and updating wrong ones from ext-panning.js
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2334 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -3,62 +3,38 @@
|
|||||||
*
|
*
|
||||||
* Licensed under the MIT License
|
* Licensed under the MIT License
|
||||||
*
|
*
|
||||||
* Copyright(c) 2010 Alexis Deveria
|
* Copyright(c) 2013 Luis Aguirre
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a very basic SVG-Edit extension. It adds a "Hello World" button in
|
This is a very basic SVG-Edit extension to let tablet/mobile devices panning without problem
|
||||||
the left panel. Clicking on the button, and then the canvas will show the
|
|
||||||
user the point on the canvas that was clicked on.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
svgEditor.addExtension("ext-panning", function() {
|
svgEditor.addExtension("ext-panning", function() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "Extension Panning",
|
name: "Extension Panning",
|
||||||
// For more notes on how to make an icon file, see the source of
|
|
||||||
// the hellorworld-icon.xml
|
|
||||||
svgicons: "extensions/ext-panning.xml",
|
svgicons: "extensions/ext-panning.xml",
|
||||||
|
|
||||||
// Multiple buttons can be added in this array
|
|
||||||
buttons: [{
|
buttons: [{
|
||||||
// Must match the icon ID in helloworld-icon.xml
|
|
||||||
id: "ext-panning",
|
id: "ext-panning",
|
||||||
|
|
||||||
// This indicates that the button will be added to the "mode"
|
|
||||||
// button panel on the left side
|
|
||||||
type: "mode",
|
type: "mode",
|
||||||
|
|
||||||
// Tooltip text
|
|
||||||
title: "Panning",
|
title: "Panning",
|
||||||
|
|
||||||
// Events
|
|
||||||
events: {
|
events: {
|
||||||
'click': function() {
|
'click': function() {
|
||||||
// The action taken when the button is clicked on.
|
|
||||||
// For "mode" buttons, any other button will
|
|
||||||
// automatically be de-pressed.
|
|
||||||
svgCanvas.setMode("ext-panning");
|
svgCanvas.setMode("ext-panning");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
// This is triggered when the main mouse button is pressed down
|
|
||||||
// on the editor canvas (not the tool panels)
|
|
||||||
mouseDown: function() {
|
mouseDown: function() {
|
||||||
// Check the mode on mousedown
|
|
||||||
if(svgCanvas.getMode() == "ext-panning") {
|
if(svgCanvas.getMode() == "ext-panning") {
|
||||||
svgEditor.setPan(true);
|
svgEditor.setPan(true);
|
||||||
// The returned object must include "started" with
|
|
||||||
// a value of true in order for mouseUp to be triggered
|
|
||||||
return {started: true};
|
return {started: true};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// This is triggered from anywhere, but "started" must have been set
|
|
||||||
// to true (see above). Note that "opts" is an object with event info
|
|
||||||
mouseUp: function(opts) {
|
mouseUp: function(opts) {
|
||||||
// Check the mode on mouseup
|
|
||||||
if(svgCanvas.getMode() == "ext-panning") {
|
if(svgCanvas.getMode() == "ext-panning") {
|
||||||
svgEditor.setPan(false);
|
svgEditor.setPan(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user