From 56d404522a61f03659337842cd48c598bc83254b Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 23 Oct 2013 01:31:03 +0200 Subject: [PATCH] Move loadFromSvg and saveToSvg to better position in file. --- js_src/canvasDrawing.js | 75 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/js_src/canvasDrawing.js b/js_src/canvasDrawing.js index 62e9222..51f1ba6 100644 --- a/js_src/canvasDrawing.js +++ b/js_src/canvasDrawing.js @@ -263,43 +263,6 @@ function adjustPreviewTransformation() { } -/* * * * * * * * * * - * - * MOUSE/TOUCH EVENTHANDLERS - * - * * * * * * * * * */ -function onCanvasMouseDown(e) { - // console.log("onmousedown >> e.offsetX,e.offsetY = " + e.offsetX+","+e.offsetY); - // console.log("onmousedown >> e.layerX,e.layerY= " + e.layerX+","+e.layerY); - // console.log("onmousedown >> e: " + e); - // console.log(e); -// console.log("f:onCanvasMouseDown()"); - dragging = true; - - prevCountingTime = new Date().getTime(); - movementCounter = 0 - -// _points.push([e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop, true]); -// adjustBounds(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop); -// adjustPreviewTransformation(); -// draw(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop, 0.5); - - var x, y; - if (e.offsetX != undefined) { - x = e.offsetX; - y = e.offsetY; - } else { - x = e.layerX; - y = e.layerY; - } -// console.log(" x: " + x + ", y: " + y); - - _points.push([x, y, true]); - adjustBounds(x, y); - adjustPreviewTransformation(); - draw(x, y, 0.5); -} - function loadFromSvg(svgData) { var mode = '', x = 0, y = 0; @@ -419,6 +382,44 @@ function saveToSvg() { return svg; } + +/* * * * * * * * * * + * + * MOUSE/TOUCH EVENTHANDLERS + * + * * * * * * * * * */ +function onCanvasMouseDown(e) { + // console.log("onmousedown >> e.offsetX,e.offsetY = " + e.offsetX+","+e.offsetY); + // console.log("onmousedown >> e.layerX,e.layerY= " + e.layerX+","+e.layerY); + // console.log("onmousedown >> e: " + e); + // console.log(e); +// console.log("f:onCanvasMouseDown()"); + dragging = true; + + prevCountingTime = new Date().getTime(); + movementCounter = 0 + +// _points.push([e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop, true]); +// adjustBounds(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop); +// adjustPreviewTransformation(); +// draw(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop, 0.5); + + var x, y; + if (e.offsetX != undefined) { + x = e.offsetX; + y = e.offsetY; + } else { + x = e.layerX; + y = e.layerY; + } +// console.log(" x: " + x + ", y: " + y); + + _points.push([x, y, true]); + adjustBounds(x, y); + adjustPreviewTransformation(); + draw(x, y, 0.5); +} + var prevPoint = {x:-1, y:-1}; function onCanvasMouseMove(e) { // console.log("f:onCanvasMouseMove()");