From 67bd9735d827667ec99f868f83a1a2fdc5379d7d Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Wed, 25 Jul 2012 11:27:20 -0500 Subject: [PATCH] opacity mouse scroll now works --- editor/jquery-draginput.js | 6 +++--- editor/svgedit.compiled.js | 4 ++-- method-draw/jquery-draginput.js | 6 +++--- method-draw/svgedit.compiled.js | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/editor/jquery-draginput.js b/editor/jquery-draginput.js index 33139b6..94eef6a 100644 --- a/editor/jquery-draginput.js +++ b/editor/jquery-draginput.js @@ -10,7 +10,7 @@ $.fn.dragInput = function(cfg){ this.dragCfg = { min: cfg && !isNaN(parseFloat(cfg.min)) ? Number(cfg.min) : null, // Fixes bug with min:0 max: cfg && !isNaN(parseFloat(cfg.max)) ? Number(cfg.max) : null, - step: cfg && cfg.step ? Number(cfg.step) : 1, + step: cfg && Number(cfg.step) ? cfg.step : 1, stepfunc: cfg && cfg.stepfunc ? cfg.stepfunc : false, page: cfg && cfg.page ? Number(cfg.page) : 10, reset: cfg && cfg.reset ? cfg.reset : this.value, @@ -149,9 +149,9 @@ $.fn.dragInput = function(cfg){ .bind("mousewheel", function(e, delta, deltaX, deltaY){ if (deltaY > 0) - this.adjustValue(this.dragCfg.step, true); + this.adjustValue(this.dragCfg.step); else if (deltaY < 0) - this.adjustValue(-this.dragCfg.step, true); + this.adjustValue(-this.dragCfg.step); e.preventDefault(); }) diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 397b87c..d42f7e3 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -497,12 +497,12 @@ R/2;S[0].scrollTop=w.y-Q/2}if(curConfig.showRulers){k(aa,V);S.scroll()}},D=[],E= '"';else if(n.length){for(var C=0;C0?(s-m)/b:200,d=f/c*b,k=0,q=this.getAttribute("data-attr"),B=svgEditor.canvas,o=B.getSelectedElems(),J=svgedit.browser.isTouch(),U=f&&this.dragCfg.cursor?$("
").appendTo(p):false;g.attr("readonly", "readonly");U&&!isNaN(this.dragCfg.start)&&U.css("top",this.dragCfg.start*-1/d+c);this.adjustValue=function(M,I){var S;S=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,M):Number((Number(this.value)+Number(M)).toFixed(5));if(s!==null)S=Math.min(S,s);if(m!==null)S=Math.max(S,m);U&&this.updateCursor(S);this.value=S;p.attr("data-value",S);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,I)};p.toggleClass("draginput",p.is("label"));this.move= function(M,I,S){if(J)M=M.originalEvent.touches[0];if(k===0)k=I;I=(M.pageY-k)*-1;k=M.pageY;S=I*d;this.adjustValue(S.toFixed(b<1?1:0))};this.stop=function(){$("body").removeClass("dragging");p.removeClass("active");$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");k=0;if(o[0]){var M=B.undoMgr.finishUndoableChange();M.isEmpty()||B.undoMgr.addCommandToHistory(M)}this.adjustValue(0)};this.updateCursor=function(){var M=parseFloat(this.value)*-1/d+c;U.css("top", M)};this.start=function(M){if(J)M=M.originalEvent.touches[0];var I=M.pageY,S=this.value,Y=this;B.undoMgr.beginUndoableChange(q,o);$("body").addClass("dragging");p.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(P){Y.move(P,I,parseFloat(S))});$(window).bind("mouseup.draginput touchend.draginput",function(){Y.stop()})};$(this).attr("readonly","readonly").attr("data-scale",d).attr("data-domain",c).attr("data-cursor",U!=false).bind("mousedown touchstart",function(M){this.blur(); -this.start(M)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(M){switch(M.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(M,I,S,Y){if(Y>0)this.adjustValue(this.dragCfg.step,true);else Y<0&&this.adjustValue(-this.dragCfg.step,true);M.preventDefault()})})}; +this.start(M)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(M){switch(M.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(M,I,S,Y){if(Y>0)this.adjustValue(this.dragCfg.step);else Y<0&&this.adjustValue(-this.dragCfg.step);M.preventDefault()})})}; $.fn.dragInput.updateCursor=function(a){var p=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),c=parseFloat(a.getAttribute("data-domain"));p=p*-1/g+c+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=p};svgedit=svgedit||{}; (function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var p=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("
  • ");var g=p.shortcut||"";$("#cmenu_canvas").append("
  • "+p.label+""+g+"
  • ")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions= {}};svgedit.contextmenu.add=function(p){if(p&&p.id&&p.label&&p.action&&typeof p.action=="function")if(p.id in a.contextMenuExtensions)console.error('Cannot add extension "'+p.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+p.id+", label:"+p.label+"}");a.contextMenuExtensions[p.id]=p}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler= diff --git a/method-draw/jquery-draginput.js b/method-draw/jquery-draginput.js index 33139b6..94eef6a 100644 --- a/method-draw/jquery-draginput.js +++ b/method-draw/jquery-draginput.js @@ -10,7 +10,7 @@ $.fn.dragInput = function(cfg){ this.dragCfg = { min: cfg && !isNaN(parseFloat(cfg.min)) ? Number(cfg.min) : null, // Fixes bug with min:0 max: cfg && !isNaN(parseFloat(cfg.max)) ? Number(cfg.max) : null, - step: cfg && cfg.step ? Number(cfg.step) : 1, + step: cfg && Number(cfg.step) ? cfg.step : 1, stepfunc: cfg && cfg.stepfunc ? cfg.stepfunc : false, page: cfg && cfg.page ? Number(cfg.page) : 10, reset: cfg && cfg.reset ? cfg.reset : this.value, @@ -149,9 +149,9 @@ $.fn.dragInput = function(cfg){ .bind("mousewheel", function(e, delta, deltaX, deltaY){ if (deltaY > 0) - this.adjustValue(this.dragCfg.step, true); + this.adjustValue(this.dragCfg.step); else if (deltaY < 0) - this.adjustValue(-this.dragCfg.step, true); + this.adjustValue(-this.dragCfg.step); e.preventDefault(); }) diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 397b87c..d42f7e3 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -497,12 +497,12 @@ R/2;S[0].scrollTop=w.y-Q/2}if(curConfig.showRulers){k(aa,V);S.scroll()}},D=[],E= '"';else if(n.length){for(var C=0;C0?(s-m)/b:200,d=f/c*b,k=0,q=this.getAttribute("data-attr"),B=svgEditor.canvas,o=B.getSelectedElems(),J=svgedit.browser.isTouch(),U=f&&this.dragCfg.cursor?$("
    ").appendTo(p):false;g.attr("readonly", "readonly");U&&!isNaN(this.dragCfg.start)&&U.css("top",this.dragCfg.start*-1/d+c);this.adjustValue=function(M,I){var S;S=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,M):Number((Number(this.value)+Number(M)).toFixed(5));if(s!==null)S=Math.min(S,s);if(m!==null)S=Math.max(S,m);U&&this.updateCursor(S);this.value=S;p.attr("data-value",S);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,I)};p.toggleClass("draginput",p.is("label"));this.move= function(M,I,S){if(J)M=M.originalEvent.touches[0];if(k===0)k=I;I=(M.pageY-k)*-1;k=M.pageY;S=I*d;this.adjustValue(S.toFixed(b<1?1:0))};this.stop=function(){$("body").removeClass("dragging");p.removeClass("active");$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");k=0;if(o[0]){var M=B.undoMgr.finishUndoableChange();M.isEmpty()||B.undoMgr.addCommandToHistory(M)}this.adjustValue(0)};this.updateCursor=function(){var M=parseFloat(this.value)*-1/d+c;U.css("top", M)};this.start=function(M){if(J)M=M.originalEvent.touches[0];var I=M.pageY,S=this.value,Y=this;B.undoMgr.beginUndoableChange(q,o);$("body").addClass("dragging");p.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(P){Y.move(P,I,parseFloat(S))});$(window).bind("mouseup.draginput touchend.draginput",function(){Y.stop()})};$(this).attr("readonly","readonly").attr("data-scale",d).attr("data-domain",c).attr("data-cursor",U!=false).bind("mousedown touchstart",function(M){this.blur(); -this.start(M)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(M){switch(M.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(M,I,S,Y){if(Y>0)this.adjustValue(this.dragCfg.step,true);else Y<0&&this.adjustValue(-this.dragCfg.step,true);M.preventDefault()})})}; +this.start(M)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(M){switch(M.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(M,I,S,Y){if(Y>0)this.adjustValue(this.dragCfg.step);else Y<0&&this.adjustValue(-this.dragCfg.step);M.preventDefault()})})}; $.fn.dragInput.updateCursor=function(a){var p=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),c=parseFloat(a.getAttribute("data-domain"));p=p*-1/g+c+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=p};svgedit=svgedit||{}; (function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var p=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("
  • ");var g=p.shortcut||"";$("#cmenu_canvas").append("
  • "+p.label+""+g+"
  • ")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions= {}};svgedit.contextmenu.add=function(p){if(p&&p.id&&p.label&&p.action&&typeof p.action=="function")if(p.id in a.contextMenuExtensions)console.error('Cannot add extension "'+p.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+p.id+", label:"+p.label+"}");a.contextMenuExtensions[p.id]=p}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=