From 5cad5c99810ae6a6110d9fa534eb1eb16eb55e6e Mon Sep 17 00:00:00 2001 From: Bruno Heridet Date: Wed, 20 Feb 2013 21:40:21 +0000 Subject: [PATCH] camelCased default_img_url -> defaultImageURL git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2445 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 23 +++++++---------------- editor/svgcanvas.js | 3 +-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 08ebe269..eb716927 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -517,7 +517,7 @@ path = svgCanvas.pathActions, undoMgr = svgCanvas.undoMgr, Utils = svgedit.utilities, - default_img_url = curConfig.imgPath + 'logo.png', + defaultImageURL = curConfig.imgPath + 'logo.png', workarea = $('#workarea'), canv_menu = $('#cmenu_canvas'), layer_menu = $('#cmenu_layers'), @@ -1433,8 +1433,7 @@ }; var setImageURL = Editor.setImageURL = function(url) { - if (!url) url = default_img_url; - + if (!url) url = defaultImageURL; svgCanvas.setImageURL(url); $('#image_url').val(url); @@ -1444,14 +1443,10 @@ $('#change_image_url').show(); } else { // regular URL - svgCanvas.embedImage(url, function(datauri) { - if (!datauri) { - // Couldn't embed, so show warning - $('#url_notice').show(); - } else { - $('#url_notice').hide(); - } - default_img_url = url; + svgCanvas.embedImage(url, function(dataURI) { + // Couldn't embed, so show warning + $('#url_notice').toggle(!dataURI); + defaultImageURL = url; }); $('#image_url').show(); $('#change_image_url').hide(); @@ -2048,8 +2043,6 @@ on_button = false; }).mousedown(function(evt) { // $('.contextMenu').hide(); -// console.log('cm', $(evt.target).closest('.contextMenu')); - var islib = $(evt.target).closest('div.tools_flyout, .contextMenu').length; if (!islib) $('.tools_flyout:visible,.contextMenu').fadeOut(250); }); @@ -2412,7 +2405,6 @@ var pasteInCenter = function() { var zoom = svgCanvas.getZoom(); - var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW; var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH; svgCanvas.pasteElements('point', x, y); @@ -2571,6 +2563,7 @@ var clickOpen = function(){ svgCanvas.open(); }; + var clickImport = function(){ }; @@ -2862,7 +2855,6 @@ elems.each(function() { // Handled in CSS // this.style[uaPrefix + 'Transform'] = 'scale(' + scale + ')'; - var el = $(this); var w = el.outerWidth() * (scale - 1); var h = el.outerHeight() * (scale - 1); @@ -3141,7 +3133,6 @@ }; var win_wh = {width:$(window).width(), height:$(window).height()}; - var resetScrollPos = $.noop, curScrollPos; // Fix for Issue 781: Drawing area jumps to top-left corner on window resize (IE9) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 7f56d186..79510382 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -4246,7 +4246,6 @@ this.svgToString = function(elem, indent) { // callback - Optional function to run when image data is found, supplies the // result (data URL or false) as first parameter. this.embedImage = function(val, callback) { - // load in the image and once it's loaded, get the dimensions $(new Image()).load(function() { // create a canvas the same size as the raster image @@ -4254,7 +4253,7 @@ this.embedImage = function(val, callback) { canvas.width = this.width; canvas.height = this.height; // load the raster image into the canvas - canvas.getContext("2d").drawImage(this,0,0); + canvas.getContext("2d").drawImage(this, 0, 0); // retrieve the data: URL try { var urldata = ';svgedit_url=' + encodeURIComponent(val);