Permalink
Browse files

Update SVG-Edit

Bugfixes and features
  • Loading branch information...
1 parent 977f13f commit aa6c4e1125b51cf98888a5f022011922fe55e2dd @distler distler committed Feb 7, 2013
@@ -0,0 +1,48 @@
+/*
+ * 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
+ }
+ }
+ }
+ };
+});
+
@@ -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>
@@ -1484,3 +1484,4 @@ span.zoom_tool {
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }
*/
+foreignObject {line-height:1.0}
@@ -47,6 +47,7 @@
<!-- you can load extensions here -->
<!-- <script type="text/javascript" src="extensions/ext-helloworld.js"></script> -->
+<script type="text/javascript" src="extensions/ext-panning.js"></script>
<!-- always minified scripts -->
<script type="text/javascript" src="jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
@@ -2055,6 +2055,10 @@
workarea.css('cursor', zoomInIcon);
}
})
+
+ Editor.setPanning = function(active) {
+ svgCanvas.spaceKey = keypan = active;
+ }
}());
@@ -4753,7 +4757,7 @@
updateCanvas(true);
// });
- // var revnums = "svg-editor.js ($Rev: 2318 $) ";
+ // var revnums = "svg-editor.js ($Rev: 2332 $) ";
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute("title", revnums);
@@ -2365,6 +2365,17 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
}
root_sctm = svgcontent.getScreenCTM().inverse();
+
+ // Firefox issue 1046
+ if(current_zoom != 1 && root_sctm.a == 1)
+ {
+ matrix_e = root_sctm.e / current_zoom - root_sctm.e;
+ matrix_f = root_sctm.f / current_zoom - root_sctm.f;
+ matrix_scale = 1/current_zoom;
+ root_sctm = svgcontent.getScreenCTM().inverse()
+ .translate(matrix_e, matrix_f)
+ .scale(matrix_scale);
+ }
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
mouse_x = pt.x * current_zoom,
@@ -6456,7 +6467,7 @@ this.getZoom = function(){return current_zoom;};
// Function: getVersion
// Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function() {
- return "svgcanvas.js ($Rev: 2310 $)";
+ return "svgcanvas.js ($Rev: 2330 $)";
};
// Function: setUiStrings

0 comments on commit aa6c4e1

Please sign in to comment.