From a975c1b935d9dd600fc05da5f9e1836fea46173f Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Thu, 26 Jul 2012 13:32:27 -0500 Subject: [PATCH] refactored focus --- editor/svg-editor.js | 7 ++----- editor/svgedit.compiled.js | 2 +- method-draw/svg-editor.js | 7 ++----- method-draw/svgedit.compiled.js | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index d682821..c354a6d 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1879,11 +1879,8 @@ } var closer = function(e){ //Method of Action specific to detect when the iframe has focus - if (top != self && !e.isTrigger) { - if(typeof top.exports.setEditorFocus == 'function') { - top.exports.setEditorFocus(); - } - } + if((top != self && !e.isTrigger) && typeof top.exports.focus_editor == 'function') top.exports.focus_editor(); + if (e.target.nodeName.toLowerCase() === "input") return false; if (!$(e.target).hasClass("menu_title") && !$(e.target).parent().hasClass("menu_title")) { if(!$(e.target).hasClass("disabled") && $(e.target).hasClass("menu_item")) blinker(e) diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 20b3446..b97fd2e 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -434,7 +434,7 @@ if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpaci if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY; if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()=== "zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart", -function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel", +function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel", function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()=== "zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart", -function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel", +function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel", function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]