Indent consistency per file

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2591 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2013-10-14 01:50:42 +00:00
parent 80c16aa6ef
commit c75661c758
8 changed files with 612 additions and 612 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ if (!svgedit.coords) {
// this is how we map paths to our preferred relative segment types
var pathMap = [0, 'z', 'M', 'm', 'L', 'l', 'C', 'c', 'Q', 'q', 'A', 'a',
'H', 'h', 'V', 'v', 'S', 's', 'T', 't'];
var editorContext_ = null;
svgedit.coords.init = function(editorContext) {
@ -48,7 +48,7 @@ svgedit.coords.remapElement = function(selected, changes, m) {
svgedit.utilities.assignAttributes(selected, changes, 1000, true);
},
box = svgedit.utilities.getBBox(selected);
for (var i = 0; i < 2; i++) {
var type = i === 0 ? 'fill' : 'stroke';
var attrVal = selected.getAttribute(type);
@ -102,7 +102,7 @@ svgedit.coords.remapElement = function(selected, changes, m) {
chlist.appendItem(mt);
}
}
// now we have a set of changes and an applied reduced transform list
// we apply the changes directly to the DOM
switch (elName) {
@ -156,7 +156,7 @@ svgedit.coords.remapElement = function(selected, changes, m) {
changes.y1 = pt1.y;
changes.x2 = pt2.x;
changes.y2 = pt2.y;
// deliberately fall through here
// deliberately fall through here
case 'text':
case 'tspan':
case 'use':
@ -165,134 +165,134 @@ svgedit.coords.remapElement = function(selected, changes, m) {
case 'g':
var gsvg = $(selected).data('gsvg');
if (gsvg) {
svgedit.utilities.assignAttributes(gsvg, changes, 1000, true);
svgedit.utilities.assignAttributes(gsvg, changes, 1000, true);
}
break;
case 'polyline':
case 'polygon':
var len = changes.points.length;
for (var i = 0; i < len; ++i) {
var pt = changes.points[i];
pt = remap(pt.x, pt.y);
changes.points[i].x = pt.x;
changes.points[i].y = pt.y;
var pt = changes.points[i];
pt = remap(pt.x, pt.y);
changes.points[i].x = pt.x;
changes.points[i].y = pt.y;
}
var len = changes.points.length;
var pstr = '';
for (var i = 0; i < len; ++i) {
var pt = changes.points[i];
pstr += pt.x + ',' + pt.y + ' ';
var pt = changes.points[i];
pstr += pt.x + ',' + pt.y + ' ';
}
selected.setAttribute('points', pstr);
break;
case 'path':
var segList = selected.pathSegList;
var len = segList.numberOfItems;
changes.d = new Array(len);
for (var i = 0; i < len; ++i) {
var seg = segList.getItem(i);
changes.d[i] = {
type: seg.pathSegType,
x: seg.x,
y: seg.y,
x1: seg.x1,
y1: seg.y1,
x2: seg.x2,
y2: seg.y2,
r1: seg.r1,
r2: seg.r2,
angle: seg.angle,
largeArcFlag: seg.largeArcFlag,
sweepFlag: seg.sweepFlag
};
}
var len = changes.d.length,
firstseg = changes.d[0],
currentpt = remap(firstseg.x, firstseg.y);
changes.d[0].x = currentpt.x;
changes.d[0].y = currentpt.y;
for (var i = 1; i < len; ++i) {
var seg = changes.d[i];
var type = seg.type;
// if absolute or first segment, we want to remap x, y, x1, y1, x2, y2
// if relative, we want to scalew, scaleh
if (type % 2 == 0) { // absolute
var thisx = (seg.x != undefined) ? seg.x : currentpt.x, // for V commands
thisy = (seg.y != undefined) ? seg.y : currentpt.y, // for H commands
pt = remap(thisx,thisy),
pt1 = remap(seg.x1, seg.y1),
pt2 = remap(seg.x2, seg.y2);
seg.x = pt.x;
seg.y = pt.y;
seg.x1 = pt1.x;
seg.y1 = pt1.y;
seg.x2 = pt2.x;
seg.y2 = pt2.y;
seg.r1 = scalew(seg.r1),
seg.r2 = scaleh(seg.r2);
}
else { // relative
seg.x = scalew(seg.x);
seg.y = scaleh(seg.y);
seg.x1 = scalew(seg.x1);
seg.y1 = scaleh(seg.y1);
seg.x2 = scalew(seg.x2);
seg.y2 = scaleh(seg.y2);
seg.r1 = scalew(seg.r1),
seg.r2 = scaleh(seg.r2);
}
} // for each segment
var segList = selected.pathSegList;
var len = segList.numberOfItems;
changes.d = new Array(len);
for (var i = 0; i < len; ++i) {
var seg = segList.getItem(i);
changes.d[i] = {
type: seg.pathSegType,
x: seg.x,
y: seg.y,
x1: seg.x1,
y1: seg.y1,
x2: seg.x2,
y2: seg.y2,
r1: seg.r1,
r2: seg.r2,
angle: seg.angle,
largeArcFlag: seg.largeArcFlag,
sweepFlag: seg.sweepFlag
};
}
var len = changes.d.length,
firstseg = changes.d[0],
currentpt = remap(firstseg.x, firstseg.y);
changes.d[0].x = currentpt.x;
changes.d[0].y = currentpt.y;
for (var i = 1; i < len; ++i) {
var seg = changes.d[i];
var type = seg.type;
// if absolute or first segment, we want to remap x, y, x1, y1, x2, y2
// if relative, we want to scalew, scaleh
if (type % 2 == 0) { // absolute
var thisx = (seg.x != undefined) ? seg.x : currentpt.x, // for V commands
thisy = (seg.y != undefined) ? seg.y : currentpt.y, // for H commands
pt = remap(thisx,thisy),
pt1 = remap(seg.x1, seg.y1),
pt2 = remap(seg.x2, seg.y2);
seg.x = pt.x;
seg.y = pt.y;
seg.x1 = pt1.x;
seg.y1 = pt1.y;
seg.x2 = pt2.x;
seg.y2 = pt2.y;
seg.r1 = scalew(seg.r1),
seg.r2 = scaleh(seg.r2);
}
else { // relative
seg.x = scalew(seg.x);
seg.y = scaleh(seg.y);
seg.x1 = scalew(seg.x1);
seg.y1 = scaleh(seg.y1);
seg.x2 = scalew(seg.x2);
seg.y2 = scaleh(seg.y2);
seg.r1 = scalew(seg.r1),
seg.r2 = scaleh(seg.r2);
}
} // for each segment
var dstr = '';
var len = changes.d.length;
for (var i = 0; i < len; ++i) {
var seg = changes.d[i];
var type = seg.type;
dstr += pathMap[type];
switch (type) {
case 13: // relative horizontal line (h)
case 12: // absolute horizontal line (H)
dstr += seg.x + ' ';
break;
case 15: // relative vertical line (v)
case 14: // absolute vertical line (V)
dstr += seg.y + ' ';
break;
case 3: // relative move (m)
case 5: // relative line (l)
case 19: // relative smooth quad (t)
case 2: // absolute move (M)
case 4: // absolute line (L)
case 18: // absolute smooth quad (T)
dstr += seg.x + ',' + seg.y + ' ';
break;
case 7: // relative cubic (c)
case 6: // absolute cubic (C)
dstr += seg.x1 + ',' + seg.y1 + ' ' + seg.x2 + ',' + seg.y2 + ' ' +
seg.x + ',' + seg.y + ' ';
break;
case 9: // relative quad (q)
case 8: // absolute quad (Q)
dstr += seg.x1 + ',' + seg.y1 + ' ' + seg.x + ',' + seg.y + ' ';
break;
case 11: // relative elliptical arc (a)
case 10: // absolute elliptical arc (A)
dstr += seg.r1 + ',' + seg.r2 + ' ' + seg.angle + ' ' + (+seg.largeArcFlag) +
' ' + (+seg.sweepFlag) + ' ' + seg.x + ',' + seg.y + ' ';
break;
case 17: // relative smooth cubic (s)
case 16: // absolute smooth cubic (S)
dstr += seg.x2 + ',' + seg.y2 + ' ' + seg.x + ',' + seg.y + ' ';
break;
}
}
var dstr = '';
var len = changes.d.length;
for (var i = 0; i < len; ++i) {
var seg = changes.d[i];
var type = seg.type;
dstr += pathMap[type];
switch (type) {
case 13: // relative horizontal line (h)
case 12: // absolute horizontal line (H)
dstr += seg.x + ' ';
break;
case 15: // relative vertical line (v)
case 14: // absolute vertical line (V)
dstr += seg.y + ' ';
break;
case 3: // relative move (m)
case 5: // relative line (l)
case 19: // relative smooth quad (t)
case 2: // absolute move (M)
case 4: // absolute line (L)
case 18: // absolute smooth quad (T)
dstr += seg.x + ',' + seg.y + ' ';
break;
case 7: // relative cubic (c)
case 6: // absolute cubic (C)
dstr += seg.x1 + ',' + seg.y1 + ' ' + seg.x2 + ',' + seg.y2 + ' ' +
seg.x + ',' + seg.y + ' ';
break;
case 9: // relative quad (q)
case 8: // absolute quad (Q)
dstr += seg.x1 + ',' + seg.y1 + ' ' + seg.x + ',' + seg.y + ' ';
break;
case 11: // relative elliptical arc (a)
case 10: // absolute elliptical arc (A)
dstr += seg.r1 + ',' + seg.r2 + ' ' + seg.angle + ' ' + (+seg.largeArcFlag) +
' ' + (+seg.sweepFlag) + ' ' + seg.x + ',' + seg.y + ' ';
break;
case 17: // relative smooth cubic (s)
case 16: // absolute smooth cubic (S)
dstr += seg.x2 + ',' + seg.y2 + ' ' + seg.x + ',' + seg.y + ' ';
break;
}
}
selected.setAttribute('d', dstr);
break;
}
selected.setAttribute('d', dstr);
break;
}
};
})();

View File

@ -214,7 +214,7 @@ svgEditor.readLang({
"enterUniqueLayerName":"Insira um nome único",
"enterNewLayerName":"Insira um novo nome",
"layerHasThatName":"A camada já pussui este nome",
"QmoveElemsToLayer":"Mover elementos selecionados para a camada: \"%s\"?",
"QmoveElemsToLayer":"Mover elementos selecionados para a camada: \"%s\"?",
"QwantToClear":"Deseja criar um novo arquivo?\nO histórico também será apagado!",
"QwantToOpen":"Deseja abrir um novo arquivo?\nO histórico também será apagado!",
"QerrorsRevertToSource":"Foram encontrados erros ná análise do código SVG.\nReverter para o código SVG original?",

View File

@ -67,7 +67,7 @@ svgedit.recalculate.recalculateDimensions = function(selected) {
// Firefox Issue - 1081
if (selected.nodeName == "svg" && navigator.userAgent.indexOf("Firefox/20") >= 0) {
return null;
return null;
}
var svgroot = context_.getSVGRoot();

View File

@ -185,7 +185,7 @@
<div class="tool_button" id="tool_wireframe" title="Wireframe Mode [F]"></div>
</div>
<!-- History buttons -->
<!-- History buttons -->
<div id="history_panel">
<div class="tool_sep"></div>
<div class="push_button tool_button_disabled" id="tool_undo" title="Undo [Z]"></div>
@ -475,7 +475,7 @@
<div id="tools_bottom" class="tools_panel">
<!-- Zoom buttons -->
<!-- Zoom buttons -->
<div id="zoom_panel" class="toolset" title="Change zoom level">
<label>
<span id="zoomLabel" class="zoom_tool icon_label"></span>
@ -776,10 +776,10 @@
<li class="separator"><a href="#delete">Delete</a></li>
<li class="separator"><a href="#group">Group<span class="shortcut">G</span></a></li>
<li><a href="#ungroup">Ungroup<span class="shortcut">G</span></a></li>
<li class="separator"><a href="#move_front">Bring to Front<span class="shortcut">SHFT+CTRL+]</span></a></li>
<li class="separator"><a href="#move_front">Bring to Front<span class="shortcut">SHFT+CTRL+]</span></a></li>
<li><a href="#move_up">Bring Forward<span class="shortcut">CTRL+]</span></a></li>
<li><a href="#move_down">Send Backward<span class="shortcut">CTRL+[</span></a></li>
<li><a href="#move_back">Send to Back<span class="shortcut">SHFT+CTRL+[</span></a></li>
<li><a href="#move_back">Send to Back<span class="shortcut">SHFT+CTRL+[</span></a></li>
</ul>

View File

@ -4573,11 +4573,11 @@
// Callback handler for embedapi.js
try {
window.addEventListener('message', function(e) {
// We accept and post strings for the sake of IE9 support
if (typeof e.data !== 'string') {
return;
}
var data = JSON.parse(e.data);
// We accept and post strings for the sake of IE9 support
if (typeof e.data !== 'string') {
return;
}
var data = JSON.parse(e.data);
if (!data || typeof data !== 'object' || data.namespace !== 'svgCanvas') {
return;
}

View File

@ -1465,7 +1465,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
if (isWebkit) delayedStroke(mouse_target);
var all = mouse_target.getElementsByTagName('*'),
len = all.length;
len = all.length;
for (var i = 0; i < len; i++) {
all[i].style.vectorEffect = 'non-scaling-stroke';
if (isWebkit) delayedStroke(all[i]);
@ -4110,13 +4110,13 @@ this.svgToString = function(elem, indent) {
// Check elements for namespaces, add if found
$(elem).find('*').andSelf().each(function() {
var el = this;
// for some elements have no attribute
var uri = this.namespaceURI;
if(uri && !nsuris[uri] && nsMap[uri] && nsMap[uri] !== 'xmlns' && nsMap[uri] !== 'xml' ) {
nsuris[uri] = true;
out.push(" xmlns:" + nsMap[uri] + '="' + uri +'"');
}
// for some elements have no attribute
var uri = this.namespaceURI;
if(uri && !nsuris[uri] && nsMap[uri] && nsMap[uri] !== 'xmlns' && nsMap[uri] !== 'xml' ) {
nsuris[uri] = true;
out.push(" xmlns:" + nsMap[uri] + '="' + uri +'"');
}
$.each(this.attributes, function(i, attr) {
var uri = attr.namespaceURI;
if (uri && !nsuris[uri] && nsMap[uri] !== 'xmlns' && nsMap[uri] !== 'xml' ) {
@ -4342,7 +4342,7 @@ this.getSvgString = function() {
//
// Parameters:
// an opional boolean, which, if true, adds a nonce to the prefix. Thus
// svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true)
// svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true)
//
// if you're controlling SVG-Edit externally, and want randomized IDs, call
// this BEFORE calling svgCanvas.setSvgString
@ -4527,15 +4527,15 @@ var convertGradients = this.convertGradients = function(elem) {
// the gradient be updated as the element is moved, as
// inkscape/illustrator do.
// var g_coords = $(grad).attr(['cx', 'cy', 'r']);
//
// var g_coords = $(grad).attr(['cx', 'cy', 'r']);
//
// $(grad).attr({
// cx: (g_coords.cx - bb.x) / bb.width,
// cy: (g_coords.cy - bb.y) / bb.height,
// r: g_coords.r
// });
//
// grad.removeAttribute('gradientUnits');
// grad.removeAttribute('gradientUnits');
}
}
});

View File

@ -74,7 +74,7 @@ svgedit.utilities.fromXml = function(str) {
// Base64 code from Tyler Akins -- http://rumkin.com
// schiller: Removed string concatenation in favour of Array.join() optimization,
// also precalculate the size of the array needed.
// also precalculate the size of the array needed.
// Function: svgedit.utilities.encode64
// Converts a string to base64