refactored focus

master
Mark MacKay 2012-07-26 13:42:20 -05:00
parent a975c1b935
commit 9ae60d7290
6 changed files with 22 additions and 4 deletions

View File

@ -14,7 +14,7 @@ svgEditor.addExtension("server_opensave", {
var save_png_action = 'extensions/filesave.php';
// Create upload target (hidden iframe)
var target = $('<iframe name="output_frame" src="#"/>').hide().appendTo('body');
var target = $('<iframe name="output_frame" />').hide().appendTo('body');
svgEditor.setCustomHandlers({
save: function(win, data) {

View File

@ -2537,6 +2537,15 @@
$('#svg_source_textarea').css('height', height);
};
var clickSave = function(){
// In the future, more options can be provided here
var saveOpts = {
'images': curPrefs.img_save,
'round_digits': 6
}
svgCanvas.save(saveOpts);
};
var saveSourceEditor = function(){
if (!editingsource) return;

View File

@ -471,7 +471,7 @@ R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},

View File

@ -14,7 +14,7 @@ svgEditor.addExtension("server_opensave", {
var save_png_action = 'extensions/filesave.php';
// Create upload target (hidden iframe)
var target = $('<iframe name="output_frame" src="#"/>').hide().appendTo('body');
var target = $('<iframe name="output_frame" />').hide().appendTo('body');
svgEditor.setCustomHandlers({
save: function(win, data) {

View File

@ -2537,6 +2537,15 @@
$('#svg_source_textarea').css('height', height);
};
var clickSave = function(){
// In the future, more options can be provided here
var saveOpts = {
'images': curPrefs.img_save,
'round_digits': 6
}
svgCanvas.save(saveOpts);
};
var saveSourceEditor = function(){
if (!editingsource) return;

View File

@ -471,7 +471,7 @@ R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},