diff --git a/editor/svg-editor.css b/editor/svg-editor.css index e040e0ee..e6e7d9a4 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -329,6 +329,17 @@ div.color_block { text-align: center; } +#svg_docprops #svg_docprops_container { + position: absolute; + top: 100px; + left: 80px; + right: 80px; + bottom: 100px; + background-color: #B0B0B0; + opacity: 1.0; + text-align: center; +} + #svg_source_editor #svg_source_textarea { position: relative; width: 95%; @@ -338,12 +349,12 @@ div.color_block { font-size: 12px; } -#svg_source_editor #tool_source_back { +#svg_source_editor #tool_source_back, #svg_source_editor #tool_docprops_back { text-align: left; padding-left: 20px; } -#svg_source_editor button { +#svg_source_editor button, #svg_docprops button { padding: 5px 2px 6px 28px; margin: 5px 20px 0 0; } @@ -362,10 +373,10 @@ div.color_block { opacity: 0.6; } -#tool_source_save { +#tool_source_save, #tool_docprops_save { background: #E8E8E8 url(images/save.png) no-repeat 2px 2px; } -#tool_source_cancel { +#tool_source_cancel, #tool_docprops_cancel { background: #E8E8E8 url(images/cancel.png) no-repeat 2px 2px; } diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 58634317..8be35655 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -47,7 +47,7 @@ Save Source - + @@ -284,22 +284,6 @@
- -
@@ -317,7 +301,12 @@
-
+
+
+ + +
+
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index fbb05fd2..d443ffa0 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -25,6 +25,7 @@ function svg_edit_setup() { var selectedElement = null; var multiselected = false; var editingsource = false; + var docprops = false; var length_attrs = ['x','y','x1','x2','y1','y2','cx','cy','width','height','r','rx','ry','width','height','radius']; var length_types = ['em','ex','px','cm','mm','in','pt','pc','%']; @@ -612,6 +613,12 @@ function svg_edit_setup() { $('#svg_source_textarea').focus(); }; + var showDocProperties = function(){ + if (docprops) return; + docprops = true; + $('#svg_docprops').fadeIn(); + }; + var properlySourceSizeTextArea = function(){ // TODO: remove magic numbers here and get values from CSS var height = $('#svg_source_container').height() - 80; @@ -630,16 +637,21 @@ function svg_edit_setup() { hideSourceEditor(); }; - var cancelSourceEditor = function() { - if (!editingsource) return; + var cancelOverlays = function() { + if (!editingsource && !docprops) return; - var oldString = svgCanvas.getSvgString(); - if (oldString != $('#svg_source_textarea').val()) { - if( !confirm('Ignore changes made to SVG source?') ) { - return false; + if (editingsource) { + var oldString = svgCanvas.getSvgString(); + if (oldString != $('#svg_source_textarea').val()) { + if( !confirm('Ignore changes made to SVG source?') ) { + return false; + } } + hideSourceEditor(); + } + else if (docprops) { + hideDocProperties(); } - hideSourceEditor(); }; var hideSourceEditor = function(){ @@ -648,6 +660,11 @@ function svg_edit_setup() { $('#svg_source_textarea').blur(); }; + var hideDocProperties = function(){ + $('#svg_docprops').hide(); + docprops = false; + }; + // TODO: add canvas-centering code in here $(window).resize(function(evt) { if (!editingsource) return; @@ -670,8 +687,9 @@ function svg_edit_setup() { $('#tool_save').click(clickSave); $('#tool_open').click(clickOpen); $('#tool_source').click(showSourceEditor); - $('#tool_source_cancel,#svg_source_overlay').click(cancelSourceEditor); + $('#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel').click(cancelOverlays); $('#tool_source_save').click(saveSourceEditor); + $('#tool_docprops').click(showDocProperties); $('#tool_delete').click(deleteSelected); $('#tool_delete_multi').click(deleteSelected); $('#tool_move_top').click(moveToTopSelected); @@ -767,9 +785,10 @@ function svg_edit_setup() { [modKey+'z', function(evt){clickUndo();evt.preventDefault();}], [modKey+'y', function(evt){clickRedo();evt.preventDefault();}], [modKey+'u', function(evt){showSourceEditor();evt.preventDefault();}], + [modKey+'i', function(evt){showDocProperties();evt.preventDefault();}], [modKey+'c', function(evt){clickClone();evt.preventDefault();}], [modKey+'g', function(evt){clickGroup();evt.preventDefault();}], - ['esc', cancelSourceEditor, false] + ['esc', cancelOverlays, false], ]; $.each(keys,function(i,item) { @@ -784,7 +803,6 @@ function svg_edit_setup() { setKeyBindings(); - // TODO: fix opacity being updated // TODO: go back to the color boxes having white background-color and then setting // background-image to none.png (otherwise partially transparent gradients look weird) var colorPicker = function(elem) {