Adding Padding extension for tablet/mobile devices
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2333 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
93950ca293
commit
a16a490f5e
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* ext-panning.js
|
||||
*
|
||||
* Licensed under the MIT License
|
||||
*
|
||||
* Copyright(c) 2010 Alexis Deveria
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a very basic SVG-Edit extension. It adds a "Hello World" button in
|
||||
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() {
|
||||
|
||||
return {
|
||||
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",
|
||||
|
||||
// Multiple buttons can be added in this array
|
||||
buttons: [{
|
||||
// Must match the icon ID in helloworld-icon.xml
|
||||
id: "ext-panning",
|
||||
|
||||
// This indicates that the button will be added to the "mode"
|
||||
// button panel on the left side
|
||||
type: "mode",
|
||||
|
||||
// Tooltip text
|
||||
title: "Panning",
|
||||
|
||||
// Events
|
||||
events: {
|
||||
'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");
|
||||
}
|
||||
}
|
||||
}],
|
||||
// This is triggered when the main mouse button is pressed down
|
||||
// on the editor canvas (not the tool panels)
|
||||
mouseDown: function() {
|
||||
// Check the mode on mousedown
|
||||
if(svgCanvas.getMode() == "ext-panning") {
|
||||
svgEditor.setPan(true);
|
||||
// The returned object must include "started" with
|
||||
// a value of true in order for mouseUp to be triggered
|
||||
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) {
|
||||
// Check the mode on mouseup
|
||||
if(svgCanvas.getMode() == "ext-panning") {
|
||||
svgEditor.setPan(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="ext-panning">
|
||||
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300">
|
||||
<path fill="#7f0000" stroke="#000000" stroke-width="10" d="m1.00037,150.34581l55.30305,-55.30267l0,27.65093l22.17356,0l0,-44.21833l44.21825,0l0,-22.17357l-27.65095,0l55.30267,-55.30292l55.3035,55.30292l-27.65175,0l0,22.17357l44.21835,0l0,44.21833l22.17357,0l0,-27.65093l55.30345,55.30267l-55.30345,55.3035l0,-27.65175l-22.17357,0l0,44.21834l-44.21835,0l0,22.17355l27.65175,0l-55.3035,55.30348l-55.30267,-55.30348l27.65095,0l0,-22.17355l-44.21825,0l0,-44.21834l-22.17356,0l0,27.65175l-55.30305,-55.3035z"></path>
|
||||
</svg>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 732 B |
Loading…
Reference in New Issue