Formatting changes.

This commit is contained in:
Flint O'Brien
2016-05-04 09:54:20 -04:00
parent 87e25e9d2c
commit 6023bd6f5a
4 changed files with 94 additions and 94 deletions

View File

@@ -27,9 +27,9 @@ var NS = svgedit.NS;
* an existing group element or, with three parameters, will create a new layer group element.
*
* Usage:
* new Layer( 'name', group) // Use the existing group for this layer.
* new Layer( 'name', group, svgElem) // Create a new group and add it to the DOM after group.
* new Layer( 'name', null, svgElem) // Create a new group and add it to the DOM as the last layer.
* new Layer'name', group) // Use the existing group for this layer.
* new Layer('name', group, svgElem) // Create a new group and add it to the DOM after group.
* new Layer('name', null, svgElem) // Create a new group and add it to the DOM as the last layer.
*
* @param {string} name - Layer name
* @param {SVGGElement|null} group - An existing SVG group element or null.
@@ -50,7 +50,7 @@ var Layer = svgedit.draw.Layer = function(name, group, svgElem) {
var layer_title = svgdoc.createElementNS(NS.SVG, "title");
layer_title.textContent = name;
this.group_.appendChild(layer_title);
if( group) {
if (group) {
$(group).after(this.group_);
} else {
svgElem.appendChild(this.group_);
@@ -183,7 +183,7 @@ Layer.prototype.setName = function(name, hrService) {
while (title.firstChild) { title.removeChild(title.firstChild); }
title.textContent = name;
this.name_ = name;
if( hrService) {
if (hrService) {
hrService.changeElement(title, {'#text':previousName});
}
return this.name_;

View File

@@ -360,7 +360,7 @@ var addCommandToHistory = function(cmd) {
* @param {svgedit.history.HistoryRecordingService=} hrService - if exists, return it instead of creating a new service.
* @returns {svgedit.history.HistoryRecordingService}
*/
function historyRecordingService( hrService) {
function historyRecordingService(hrService) {
return hrService ? hrService : new svgedit.history.HistoryRecordingService(canvas.undoMgr);
}
@@ -7174,7 +7174,7 @@ this.getPrivateMethods = function() {
BatchCommand: BatchCommand,
call: call,
ChangeElementCommand: ChangeElementCommand,
copyElem: function( elem) {return getCurrentDrawing().copyElem(elem)},
copyElem: function(elem) {return getCurrentDrawing().copyElem(elem)},
ffClone: ffClone,
findDefs: findDefs,
findDuplicateGradient: findDuplicateGradient,

View File

@@ -1211,10 +1211,10 @@ function pathDSegment(letter, points, morePoints, lastPoint) {
points[i] = svgedit.units.shortFloat(pnt);
});
var segment = letter + points.join(' ');
if( morePoints) {
if (morePoints) {
segment += ' ' + morePoints.join(' ');
}
if( lastPoint) {
if (lastPoint) {
segment += ' ' + svgedit.units.shortFloat(lastPoint);
}
return segment;

View File

@@ -465,18 +465,18 @@
var oldName = drawing.getCurrentLayerName();
var newName = 'New Name'
ok( drawing.layer_map[oldName]);
equals( drawing.layer_map[newName], undefined); // newName shouldn't exist.
ok(drawing.layer_map[oldName]);
equals(drawing.layer_map[newName], undefined); // newName shouldn't exist.
var result = drawing.setCurrentLayerName(newName, mockHrService);
equals(result, newName);
equals(drawing.getCurrentLayerName(), newName);
// Was the map updated?
equals( drawing.layer_map[oldName], undefined);
equals( drawing.layer_map[newName], drawing.current_layer);
equals(drawing.layer_map[oldName], undefined);
equals(drawing.layer_map[newName], drawing.current_layer);
// Was mockHrService called?
ok( mockHrService.changeElement.calledOnce);
equals( oldName, mockHrService.changeElement.getCall(0).args[1]['#text']);
equals( newName, mockHrService.changeElement.getCall(0).args[0].textContent);
ok(mockHrService.changeElement.calledOnce);
equals(oldName, mockHrService.changeElement.getCall(0).args[1]['#text']);
equals(newName, mockHrService.changeElement.getCall(0).args[0].textContent);
cleanupSvg(svg);
});
@@ -506,8 +506,8 @@
equals(NEW_LAYER_NAME, drawing.getLayerName(3));
equals(layer_g, mockHrService.insertElement.getCall(0).args[0]);
ok( mockHrService.startBatchCommand.calledOnce);
ok( mockHrService.endBatchCommand.calledOnce);
ok(mockHrService.startBatchCommand.calledOnce);
ok(mockHrService.endBatchCommand.calledOnce);
cleanupSvg(svg);
});
@@ -540,8 +540,8 @@
// check history record
ok( mockHrService.startBatchCommand.calledOnce);
ok( mockHrService.endBatchCommand.calledOnce);
ok(mockHrService.startBatchCommand.calledOnce);
ok(mockHrService.endBatchCommand.calledOnce);
equals(mockHrService.startBatchCommand.getCall(0).args[0], 'Merge Layer');
equals(mockHrService.moveElement.callCount, elementCount - 1); // -1 because the title was not moved.
equals(mockHrService.removeElement.callCount, 2); // remove group and title.
@@ -611,8 +611,8 @@
equals(layers[0].childElementCount, elementCount * 3 - 2); // -2 because two titles were deleted.
// check history record
equals( mockHrService.startBatchCommand.callCount, 3); // mergeAllLayers + 2 * mergeLayer
equals( mockHrService.endBatchCommand.callCount, 3);
equals(mockHrService.startBatchCommand.callCount, 3); // mergeAllLayers + 2 * mergeLayer
equals(mockHrService.endBatchCommand.callCount, 3);
equals(mockHrService.startBatchCommand.getCall(0).args[0], 'Merge all Layers');
equals(mockHrService.startBatchCommand.getCall(1).args[0], 'Merge Layer');
equals(mockHrService.startBatchCommand.getCall(2).args[0], 'Merge Layer');
@@ -649,8 +649,8 @@
equals(clone.childElementCount, elementCount);
// check history record
ok( mockHrService.startBatchCommand.calledOnce); // mergeAllLayers + 2 * mergeLayer
ok( mockHrService.endBatchCommand.calledOnce);
ok(mockHrService.startBatchCommand.calledOnce); // mergeAllLayers + 2 * mergeLayer
ok(mockHrService.endBatchCommand.calledOnce);
equals(mockHrService.startBatchCommand.getCall(0).args[0], 'Duplicate Layer');
equals(mockHrService.insertElement.callCount, 1);
equals(mockHrService.insertElement.getCall(0).args[0], clone);