Very minor: indent/clean-up

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2700 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-02-17 00:46:57 +00:00
parent 6fe03a595f
commit ce0e07b278
1 changed files with 38 additions and 38 deletions

View File

@ -138,8 +138,8 @@ svgEditor.addExtension("Markers", function(S) {
var ci; var ci;
$.each(mtypes, function(i, pos) { $.each(mtypes, function(i, pos) {
var m = getLinked(el,"marker-"+pos); var m = getLinked(el, "marker-" + pos);
var txtbox = $('#'+pos+'_marker'); var txtbox = $('#' + pos + '_marker');
if (!m) { if (!m) {
val = '\\nomarker'; val = '\\nomarker';
ci = val; ci = val;
@ -149,7 +149,7 @@ svgEditor.addExtension("Markers", function(S) {
val = '\\' + m.attributes.se_type.textContent; val = '\\' + m.attributes.se_type.textContent;
ci = val; ci = val;
if (val === '\\textmarker') { if (val === '\\textmarker') {
val=m.lastChild.textContent; val = m.lastChild.textContent;
//txtbox.show(); // show text box //txtbox.show(); // show text box
} else { } else {
txtbox.hide(); // hide text box txtbox.hide(); // hide text box
@ -213,9 +213,9 @@ svgEditor.addExtension("Markers", function(S) {
var text = addElem(marker_types[se_type]); var text = addElem(marker_types[se_type]);
// have to add text to get bounding box // have to add text to get bounding box
text.textContent = val; text.textContent = val;
var tb=text.getBBox(); var tb = text.getBBox();
//alert( tb.x + " " + tb.y + " " + tb.width + " " + tb.height); //alert( tb.x + " " + tb.y + " " + tb.width + " " + tb.height);
var pad=1; var pad = 1;
var bb = tb; var bb = tb;
bb.x = 0; bb.x = 0;
bb.y = 0; bb.y = 0;
@ -225,23 +225,23 @@ svgEditor.addExtension("Markers", function(S) {
text.setAttribute('x', pad); text.setAttribute('x', pad);
text.setAttribute('y', bb.height - pad - tb.height/4); // kludge? text.setAttribute('y', bb.height - pad - tb.height/4); // kludge?
text.setAttribute('fill',color); text.setAttribute('fill',color);
refX = bb.width/2+pad; refX = bb.width/2 + pad;
refY = bb.height/2+pad; refY = bb.height/2 + pad;
viewBox = bb.x + " " + bb.y + " " + bb.width + " " + bb.height; viewBox = bb.x + " " + bb.y + " " + bb.width + " " + bb.height;
markerWidth =bb.width/10; markerWidth = bb.width/10;
markerHeight = bb.height/10; markerHeight = bb.height/10;
var box = addElem({ var box = addElem({
"element": "rect", "element": "rect",
"attr": { "attr": {
"x": bb.x, "x": bb.x,
"y": bb.y, "y": bb.y,
"width": bb.width, "width": bb.width,
"height": bb.height, "height": bb.height,
"fill": txt_box_bg, "fill": txt_box_bg,
"stroke": txt_box_border, "stroke": txt_box_border,
"stroke-width": txt_box_stroke_width "stroke-width": txt_box_stroke_width
} }
}); });
marker.setAttribute("orient",0); marker.setAttribute("orient",0);
marker.appendChild(box); marker.appendChild(box);
@ -275,12 +275,12 @@ svgEditor.addExtension("Markers", function(S) {
var pline = addElem({ var pline = addElem({
"element": "polyline", "element": "polyline",
"attr": { "attr": {
"points": (x1+','+y1+ mid_pt +x2+','+y2), "points": (x1+','+y1+ mid_pt +x2+','+y2),
"stroke": elem.getAttribute('stroke'), "stroke": elem.getAttribute('stroke'),
"stroke-width": elem.getAttribute('stroke-width'), "stroke-width": elem.getAttribute('stroke-width'),
"fill": "none", "fill": "none",
"opacity": elem.getAttribute('opacity') || 1 "opacity": elem.getAttribute('opacity') || 1
} }
}); });
$.each(mtypes, function(i, pos) { // get any existing marker definitions $.each(mtypes, function(i, pos) { // get any existing marker definitions
var nam = 'marker-'+pos; var nam = 'marker-'+pos;
@ -459,23 +459,23 @@ svgEditor.addExtension("Markers", function(S) {
panel: 'marker_panel' panel: 'marker_panel'
}); });
*/ */
$.each(mtypes,function(k, pos) { $.each(mtypes, function (k, pos) {
var listname = pos + "_marker_list"; var listname = pos + "_marker_list";
var def = true; var def = true;
$.each(marker_types,function(id, v) { $.each(marker_types, function (id, v) {
var title = getTitle('en',id); var title = getTitle('en', id);
buttons.push({ buttons.push({
id:id_prefix + pos + "_" + id, id: id_prefix + pos + '_' + id,
svgicon:id, svgicon: id,
title:title, title: title,
type:'context', type: 'context',
events: { 'click': setArrowFromButton }, events: {'click': setArrowFromButton},
panel:'marker_panel', panel: 'marker_panel',
list: listname, list: listname,
isDefault: def isDefault: def
});
def = false;
}); });
def = false;
});
}); });
return buttons; return buttons;
} }
@ -496,7 +496,7 @@ svgEditor.addExtension("Markers", function(S) {
},{ },{
type: "button-select", type: "button-select",
panel: "marker_panel", panel: "marker_panel",
title: getTitle('en','start_marker_list'), title: getTitle('en', 'start_marker_list'),
id: "start_marker_list", id: "start_marker_list",
colnum: 3, colnum: 3,
events: { change: setArrowFromButton } events: { change: setArrowFromButton }
@ -512,7 +512,7 @@ svgEditor.addExtension("Markers", function(S) {
},{ },{
type: "button-select", type: "button-select",
panel: "marker_panel", panel: "marker_panel",
title: getTitle('en','mid_marker_list'), title: getTitle('en', 'mid_marker_list'),
id: "mid_marker_list", id: "mid_marker_list",
colnum: 3, colnum: 3,
events: { change: setArrowFromButton } events: { change: setArrowFromButton }
@ -527,7 +527,7 @@ svgEditor.addExtension("Markers", function(S) {
},{ },{
type: "button-select", type: "button-select",
panel: "marker_panel", panel: "marker_panel",
title: getTitle('en','end_marker_list'), title: getTitle('en', 'end_marker_list'),
id: "end_marker_list", id: "end_marker_list",
colnum: 3, colnum: 3,
events: { change: setArrowFromButton } events: { change: setArrowFromButton }
@ -551,7 +551,7 @@ svgEditor.addExtension("Markers", function(S) {
while(i--) { while(i--) {
var elem = selElems[i]; var elem = selElems[i];
if(elem && $.inArray(elem.tagName, marker_elems) !== -1) { if(elem && $.inArray(elem.tagName, marker_elems) !== -1) {
if(opts.selectedElement && !opts.multiselected) { if (opts.selectedElement && !opts.multiselected) {
showPanel(true); showPanel(true);
} else { } else {
showPanel(false); showPanel(false);