More markup for the doc properties dialog (still empty)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@637 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2009-09-13 19:58:06 +00:00
parent 3b33c919ec
commit c56fa2bd0d
3 changed files with 50 additions and 32 deletions

View File

@@ -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) {