- Linting (ESLint): Finish
- Fix: Globals (x, y) in `mouseMove` - Fix: Global (element, d_attr->dAttr) in `mouseDown` - Fix: Avoid `drawnPath` not defined error - Docs: sp.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# Vendor/minified files
|
||||||
editor/jquery.js
|
editor/jquery.js
|
||||||
editor/jspdf/jspdf.min.js
|
editor/jspdf/jspdf.min.js
|
||||||
editor/jspdf/underscore-min.js
|
editor/jspdf/underscore-min.js
|
||||||
|
|||||||
@@ -736,7 +736,7 @@ Rounds a given value to a float with number of digits defined in save_options
|
|||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
|
|
||||||
If a string/number was given, returns a Float. If an array, return a string with comma-seperated floats
|
If a string/number was given, returns a Float. If an array, return a string with comma-separated floats
|
||||||
|
|
||||||
## `getStrokedBBox`
|
## `getStrokedBBox`
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit */
|
/* globals $, svgedit */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.browser
|
* Package: svgedit.browser
|
||||||
@@ -119,7 +119,7 @@ var supportsHVLineContainerBBox_ = (function () {
|
|||||||
var bbox = g.getBBox();
|
var bbox = g.getBBox();
|
||||||
document.documentElement.removeChild(svgcontent);
|
document.documentElement.removeChild(svgcontent);
|
||||||
// Webkit gives 0, FF gives 10, Opera (correctly) gives 15
|
// Webkit gives 0, FF gives 10, Opera (correctly) gives 15
|
||||||
return (bbox.width == 15);
|
return (bbox.width === 15);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var supportsEditableText_ = (function () {
|
var supportsEditableText_ = (function () {
|
||||||
@@ -153,13 +153,13 @@ var supportsNativeSVGTransformLists_ = (function () {
|
|||||||
rxform.appendItem(t1);
|
rxform.appendItem(t1);
|
||||||
var r1 = rxform.getItem(0);
|
var r1 = rxform.getItem(0);
|
||||||
return r1 instanceof SVGTransform && t1 instanceof SVGTransform &&
|
return r1 instanceof SVGTransform && t1 instanceof SVGTransform &&
|
||||||
r1.type == t1.type && r1.angle == t1.angle &&
|
r1.type === t1.type && r1.angle === t1.angle &&
|
||||||
r1.matrix.a == t1.matrix.a &&
|
r1.matrix.a === t1.matrix.a &&
|
||||||
r1.matrix.b == t1.matrix.b &&
|
r1.matrix.b === t1.matrix.b &&
|
||||||
r1.matrix.c == t1.matrix.c &&
|
r1.matrix.c === t1.matrix.c &&
|
||||||
r1.matrix.d == t1.matrix.d &&
|
r1.matrix.d === t1.matrix.d &&
|
||||||
r1.matrix.e == t1.matrix.e &&
|
r1.matrix.e === t1.matrix.e &&
|
||||||
r1.matrix.f == t1.matrix.f;
|
r1.matrix.f === t1.matrix.f;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// Public API
|
// Public API
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgEditor */
|
/* globals $, svgEditor */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.contextmenu
|
* Package: svgedit.contextmenu
|
||||||
@@ -17,7 +17,7 @@ if (!svgedit.contextmenu) {
|
|||||||
}
|
}
|
||||||
self.contextMenuExtensions = {};
|
self.contextMenuExtensions = {};
|
||||||
var menuItemIsValid = function (menuItem) {
|
var menuItemIsValid = function (menuItem) {
|
||||||
return menuItem && menuItem.id && menuItem.label && menuItem.action && typeof menuItem.action == 'function';
|
return menuItem && menuItem.id && menuItem.label && menuItem.action && typeof menuItem.action === 'function';
|
||||||
};
|
};
|
||||||
var addContextMenuItem = function (menuItem) {
|
var addContextMenuItem = function (menuItem) {
|
||||||
// menuItem: {id, label, shortcut, action}
|
// menuItem: {id, label, shortcut, action}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgroot */
|
/* globals $, svgroot */
|
||||||
/**
|
/**
|
||||||
* Coords.
|
* Coords.
|
||||||
@@ -103,9 +103,9 @@ svgedit.coords.remapElement = function (selected, changes, m) {
|
|||||||
|
|
||||||
var elName = selected.tagName;
|
var elName = selected.tagName;
|
||||||
var chlist, mt;
|
var chlist, mt;
|
||||||
if (elName === 'g' || elName === 'text' || elName == 'tspan' || elName === 'use') {
|
if (elName === 'g' || elName === 'text' || elName === 'tspan' || elName === 'use') {
|
||||||
// if it was a translate, then just update x,y
|
// if it was a translate, then just update x,y
|
||||||
if (m.a == 1 && m.b == 0 && m.c == 0 && m.d == 1 && (m.e != 0 || m.f != 0)) {
|
if (m.a === 1 && m.b === 0 && m.c === 0 && m.d === 1 && (m.e !== 0 || m.f !== 0)) {
|
||||||
// [T][M] = [M][T']
|
// [T][M] = [M][T']
|
||||||
// therefore [T'] = [M_inv][T][M]
|
// therefore [T'] = [M_inv][T][M]
|
||||||
var existing = svgedit.math.transformListToTransform(selected).matrix,
|
var existing = svgedit.math.transformListToTransform(selected).matrix,
|
||||||
@@ -239,9 +239,9 @@ svgedit.coords.remapElement = function (selected, changes, m) {
|
|||||||
type = seg.type;
|
type = seg.type;
|
||||||
// if absolute or first segment, we want to remap x, y, x1, y1, x2, y2
|
// if absolute or first segment, we want to remap x, y, x1, y1, x2, y2
|
||||||
// if relative, we want to scalew, scaleh
|
// if relative, we want to scalew, scaleh
|
||||||
if (type % 2 == 0) { // absolute
|
if (type % 2 === 0) { // absolute
|
||||||
var thisx = (seg.x != undefined) ? seg.x : currentpt.x, // for V commands
|
var thisx = (seg.x !== undefined) ? seg.x : currentpt.x, // for V commands
|
||||||
thisy = (seg.y != undefined) ? seg.y : currentpt.y; // for H commands
|
thisy = (seg.y !== undefined) ? seg.y : currentpt.y; // for H commands
|
||||||
pt = remap(thisx, thisy);
|
pt = remap(thisx, thisy);
|
||||||
pt1 = remap(seg.x1, seg.y1);
|
pt1 = remap(seg.x1, seg.y1);
|
||||||
pt2 = remap(seg.x2, seg.y2);
|
pt2 = remap(seg.x2, seg.y2);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit */
|
/* globals $, svgedit */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.draw
|
* Package: svgedit.draw
|
||||||
@@ -42,9 +42,9 @@ svgedit.draw.randomizeIds = function (enableRandomization, currentDrawing) {
|
|||||||
? RandomizeModes.NEVER_RANDOMIZE
|
? RandomizeModes.NEVER_RANDOMIZE
|
||||||
: RandomizeModes.ALWAYS_RANDOMIZE;
|
: RandomizeModes.ALWAYS_RANDOMIZE;
|
||||||
|
|
||||||
if (randomizeIds == RandomizeModes.ALWAYS_RANDOMIZE && !currentDrawing.getNonce()) {
|
if (randomizeIds === RandomizeModes.ALWAYS_RANDOMIZE && !currentDrawing.getNonce()) {
|
||||||
currentDrawing.setNonce(Math.floor(Math.random() * 100001));
|
currentDrawing.setNonce(Math.floor(Math.random() * 100001));
|
||||||
} else if (randomizeIds == RandomizeModes.NEVER_RANDOMIZE && currentDrawing.getNonce()) {
|
} else if (randomizeIds === RandomizeModes.NEVER_RANDOMIZE && currentDrawing.getNonce()) {
|
||||||
currentDrawing.clearNonce();
|
currentDrawing.clearNonce();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -58,7 +58,7 @@ svgedit.draw.randomizeIds = function (enableRandomization, currentDrawing) {
|
|||||||
*/
|
*/
|
||||||
svgedit.draw.Drawing = function (svgElem, optIdPrefix) {
|
svgedit.draw.Drawing = function (svgElem, optIdPrefix) {
|
||||||
if (!svgElem || !svgElem.tagName || !svgElem.namespaceURI ||
|
if (!svgElem || !svgElem.tagName || !svgElem.namespaceURI ||
|
||||||
svgElem.tagName != 'svg' || svgElem.namespaceURI != NS.SVG) {
|
svgElem.tagName !== 'svg' || svgElem.namespaceURI !== NS.SVG) {
|
||||||
throw new Error('Error: svgedit.draw.Drawing instance initialized without a <svg> element');
|
throw new Error('Error: svgedit.draw.Drawing instance initialized without a <svg> element');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ svgedit.draw.Drawing = function (svgElem, optIdPrefix) {
|
|||||||
var n = this.svgElem_.getAttributeNS(NS.SE, 'nonce');
|
var n = this.svgElem_.getAttributeNS(NS.SE, 'nonce');
|
||||||
// If already set in the DOM, use the nonce throughout the document
|
// If already set in the DOM, use the nonce throughout the document
|
||||||
// else, if randomizeIds(true) has been called, create and set the nonce.
|
// else, if randomizeIds(true) has been called, create and set the nonce.
|
||||||
if (!!n && randomizeIds != RandomizeModes.NEVER_RANDOMIZE) {
|
if (!!n && randomizeIds !== RandomizeModes.NEVER_RANDOMIZE) {
|
||||||
this.nonce_ = n;
|
this.nonce_ = n;
|
||||||
} else if (randomizeIds == RandomizeModes.ALWAYS_RANDOMIZE) {
|
} else if (randomizeIds === RandomizeModes.ALWAYS_RANDOMIZE) {
|
||||||
this.setNonce(Math.floor(Math.random() * 100001));
|
this.setNonce(Math.floor(Math.random() * 100001));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -234,7 +234,7 @@ svgedit.draw.Drawing.prototype.releaseId = function (id) {
|
|||||||
|
|
||||||
// if we didn't get a positive number or we already released this number
|
// if we didn't get a positive number or we already released this number
|
||||||
// then return false.
|
// then return false.
|
||||||
if (typeof num !== 'number' || num <= 0 || this.releasedNums.indexOf(num) != -1) {
|
if (typeof num !== 'number' || num <= 0 || this.releasedNums.indexOf(num) !== -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,12 +326,12 @@ svgedit.draw.Drawing.prototype.setCurrentLayerPosition = function (newpos) {
|
|||||||
|
|
||||||
var oldpos;
|
var oldpos;
|
||||||
for (oldpos = 0; oldpos < layerCount; ++oldpos) {
|
for (oldpos = 0; oldpos < layerCount; ++oldpos) {
|
||||||
if (this.all_layers[oldpos] == this.current_layer) { break; }
|
if (this.all_layers[oldpos] === this.current_layer) { break; }
|
||||||
}
|
}
|
||||||
// some unknown error condition (current_layer not in all_layers)
|
// some unknown error condition (current_layer not in all_layers)
|
||||||
if (oldpos == layerCount) { return null; }
|
if (oldpos === layerCount) { return null; }
|
||||||
|
|
||||||
if (oldpos != newpos) {
|
if (oldpos !== newpos) {
|
||||||
// if our new position is below us, we need to insert before the node after newpos
|
// if our new position is below us, we need to insert before the node after newpos
|
||||||
var refGroup = null;
|
var refGroup = null;
|
||||||
var currentGroup = this.current_layer.getGroup();
|
var currentGroup = this.current_layer.getGroup();
|
||||||
@@ -369,7 +369,7 @@ svgedit.draw.Drawing.prototype.mergeLayer = function (hrService) {
|
|||||||
|
|
||||||
while (currentGroup.firstChild) {
|
while (currentGroup.firstChild) {
|
||||||
var child = currentGroup.firstChild;
|
var child = currentGroup.firstChild;
|
||||||
if (child.localName == 'title') {
|
if (child.localName === 'title') {
|
||||||
hrService.removeElement(child, child.nextSibling, currentGroup);
|
hrService.removeElement(child, child.nextSibling, currentGroup);
|
||||||
currentGroup.removeChild(child);
|
currentGroup.removeChild(child);
|
||||||
continue;
|
continue;
|
||||||
@@ -480,7 +480,7 @@ svgedit.draw.Drawing.prototype.identifyLayers = function () {
|
|||||||
for (var i = 0; i < numchildren; ++i) {
|
for (var i = 0; i < numchildren; ++i) {
|
||||||
var child = this.svgElem_.childNodes.item(i);
|
var child = this.svgElem_.childNodes.item(i);
|
||||||
// for each g, find its layer name
|
// for each g, find its layer name
|
||||||
if (child && child.nodeType == 1) {
|
if (child && child.nodeType === 1) {
|
||||||
if (child.tagName === 'g') {
|
if (child.tagName === 'g') {
|
||||||
childgroups = true;
|
childgroups = true;
|
||||||
var name = findLayerNameInGroup(child);
|
var name = findLayerNameInGroup(child);
|
||||||
@@ -569,7 +569,7 @@ svgedit.draw.Drawing.prototype.cloneLayer = function (name, hrService) {
|
|||||||
var index;
|
var index;
|
||||||
for (index = 0; index < children.length; index++) {
|
for (index = 0; index < children.length; index++) {
|
||||||
var ch = children[index];
|
var ch = children[index];
|
||||||
if (ch.localName == 'title') { continue; }
|
if (ch.localName === 'title') { continue; }
|
||||||
group.appendChild(this.copyElem(ch));
|
group.appendChild(this.copyElem(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals svgedit */
|
/* globals svgedit */
|
||||||
/**
|
/**
|
||||||
* Package: svedit.math
|
* Package: svedit.math
|
||||||
@@ -88,7 +88,7 @@ svgedit.math.hasMatrixTransform = function (tlist) {
|
|||||||
var num = tlist.numberOfItems;
|
var num = tlist.numberOfItems;
|
||||||
while (num--) {
|
while (num--) {
|
||||||
var xform = tlist.getItem(num);
|
var xform = tlist.getItem(num);
|
||||||
if (xform.type == 1 && !svgedit.math.isIdentity(xform.matrix)) { return true; }
|
if (xform.type === 1 && !svgedit.math.isIdentity(xform.matrix)) { return true; }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit, svgroot */
|
/* globals $, svgedit, svgroot */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.path
|
* Package: svgedit.path
|
||||||
@@ -85,7 +85,7 @@ svgedit.path.insertItemBefore = function (elem, newseg, index) {
|
|||||||
}
|
}
|
||||||
list.clear();
|
list.clear();
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (i == index) { // index + 1
|
if (i === index) { // index + 1
|
||||||
list.appendItem(newseg);
|
list.appendItem(newseg);
|
||||||
}
|
}
|
||||||
list.appendItem(arr[i]);
|
list.appendItem(arr[i]);
|
||||||
@@ -301,7 +301,7 @@ svgedit.path.replacePathSeg = function (type, index, pts, elem) {
|
|||||||
}
|
}
|
||||||
segList.clear();
|
segList.clear();
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (i == index) {
|
if (i === index) {
|
||||||
segList.appendItem(seg);
|
segList.appendItem(seg);
|
||||||
} else {
|
} else {
|
||||||
segList.appendItem(arr[i]);
|
segList.appendItem(arr[i]);
|
||||||
@@ -370,7 +370,7 @@ svgedit.path.smoothControlPoints = function (ct1, ct2, pt) {
|
|||||||
x2 = ct2.x - pt.x,
|
x2 = ct2.x - pt.x,
|
||||||
y2 = ct2.y - pt.y;
|
y2 = ct2.y - pt.y;
|
||||||
|
|
||||||
if ((x1 != 0 || y1 != 0) && (x2 != 0 || y2 != 0)) {
|
if ((x1 !== 0 || y1 !== 0) && (x2 !== 0 || y2 !== 0)) {
|
||||||
var anglea = Math.atan2(y1, x1),
|
var anglea = Math.atan2(y1, x1),
|
||||||
angleb = Math.atan2(y2, x2),
|
angleb = Math.atan2(y2, x2),
|
||||||
r1 = Math.sqrt(x1 * x1 + y1 * y1),
|
r1 = Math.sqrt(x1 * x1 + y1 * y1),
|
||||||
@@ -509,7 +509,7 @@ svgedit.path.Segment.prototype.move = function (dx, dy) {
|
|||||||
|
|
||||||
svgedit.path.Segment.prototype.setLinked = function (num) {
|
svgedit.path.Segment.prototype.setLinked = function (num) {
|
||||||
var seg, anum, pt;
|
var seg, anum, pt;
|
||||||
if (num == 2) {
|
if (num === 2) {
|
||||||
anum = 1;
|
anum = 1;
|
||||||
seg = this.next;
|
seg = this.next;
|
||||||
if (!seg) { return; }
|
if (!seg) { return; }
|
||||||
@@ -744,7 +744,7 @@ svgedit.path.Path.prototype.subpathIsClosed = function (index) {
|
|||||||
|
|
||||||
svgedit.path.Path.prototype.removePtFromSelection = function (index) {
|
svgedit.path.Path.prototype.removePtFromSelection = function (index) {
|
||||||
var pos = this.selected_pts.indexOf(index);
|
var pos = this.selected_pts.indexOf(index);
|
||||||
if (pos == -1) {
|
if (pos === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.segs[index].select(false);
|
this.segs[index].select(false);
|
||||||
@@ -810,7 +810,7 @@ svgedit.path.Path.prototype.setSegType = function (newType) {
|
|||||||
// Toggle segment to curve/straight line
|
// Toggle segment to curve/straight line
|
||||||
var oldType = cur.type;
|
var oldType = cur.type;
|
||||||
|
|
||||||
newType = (oldType == 6) ? 4 : 6;
|
newType = (oldType === 6) ? 4 : 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
newType = Number(newType);
|
newType = Number(newType);
|
||||||
@@ -965,7 +965,7 @@ svgedit.path.recalcRotatedPath = function () {
|
|||||||
i -= 1;
|
i -= 1;
|
||||||
var seg = list.getItem(i),
|
var seg = list.getItem(i),
|
||||||
type = seg.pathSegType;
|
type = seg.pathSegType;
|
||||||
if (type == 1) { continue; }
|
if (type === 1) { continue; }
|
||||||
|
|
||||||
var rvals = getRotVals(seg.x, seg.y),
|
var rvals = getRotVals(seg.x, seg.y),
|
||||||
points = [rvals.x, rvals.y];
|
points = [rvals.x, rvals.y];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq, no-redeclare */
|
/* eslint-disable no-var, no-redeclare */
|
||||||
// SVGPathSeg API polyfill
|
// SVGPathSeg API polyfill
|
||||||
// https://github.com/progers/pathseg
|
// https://github.com/progers/pathseg
|
||||||
//
|
//
|
||||||
@@ -651,11 +651,11 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
|
|
||||||
Source.prototype._nextCommandHelper = function (lookahead, previousCommand) {
|
Source.prototype._nextCommandHelper = function (lookahead, previousCommand) {
|
||||||
// Check for remaining coordinates in the current command.
|
// Check for remaining coordinates in the current command.
|
||||||
if ((lookahead === '+' || lookahead === '-' || lookahead === '.' || (lookahead >= '0' && lookahead <= '9')) && previousCommand != window.SVGPathSeg.PATHSEG_CLOSEPATH) {
|
if ((lookahead === '+' || lookahead === '-' || lookahead === '.' || (lookahead >= '0' && lookahead <= '9')) && previousCommand !== window.SVGPathSeg.PATHSEG_CLOSEPATH) {
|
||||||
if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_ABS) {
|
if (previousCommand === window.SVGPathSeg.PATHSEG_MOVETO_ABS) {
|
||||||
return window.SVGPathSeg.PATHSEG_LINETO_ABS;
|
return window.SVGPathSeg.PATHSEG_LINETO_ABS;
|
||||||
}
|
}
|
||||||
if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_REL) {
|
if (previousCommand === window.SVGPathSeg.PATHSEG_MOVETO_REL) {
|
||||||
return window.SVGPathSeg.PATHSEG_LINETO_REL;
|
return window.SVGPathSeg.PATHSEG_LINETO_REL;
|
||||||
}
|
}
|
||||||
return previousCommand;
|
return previousCommand;
|
||||||
@@ -670,7 +670,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
}
|
}
|
||||||
var command = this.peekSegmentType();
|
var command = this.peekSegmentType();
|
||||||
// Path must start with moveTo.
|
// Path must start with moveTo.
|
||||||
return command == window.SVGPathSeg.PATHSEG_MOVETO_ABS || command == window.SVGPathSeg.PATHSEG_MOVETO_REL;
|
return command === window.SVGPathSeg.PATHSEG_MOVETO_ABS || command === window.SVGPathSeg.PATHSEG_MOVETO_REL;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp.
|
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp.
|
||||||
@@ -695,7 +695,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
sign = -1;
|
sign = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._currentIndex == this._endIndex || ((this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') && this._string.charAt(this._currentIndex) !== '.')) {
|
if (this._currentIndex === this._endIndex || ((this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') && this._string.charAt(this._currentIndex) !== '.')) {
|
||||||
// The first character of a number must be one of [0-9+-.].
|
// The first character of a number must be one of [0-9+-.].
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -706,7 +706,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
this._currentIndex++; // Advance to first non-digit.
|
this._currentIndex++; // Advance to first non-digit.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._currentIndex != startIntPartIndex) {
|
if (this._currentIndex !== startIntPartIndex) {
|
||||||
var scanIntPartIndex = this._currentIndex - 1;
|
var scanIntPartIndex = this._currentIndex - 1;
|
||||||
var multiplier = 1;
|
var multiplier = 1;
|
||||||
while (scanIntPartIndex >= startIntPartIndex) {
|
while (scanIntPartIndex >= startIntPartIndex) {
|
||||||
@@ -731,7 +731,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the exponent part.
|
// Read the exponent part.
|
||||||
if (this._currentIndex != startIndex && this._currentIndex + 1 < this._endIndex && (this._string.charAt(this._currentIndex) === 'e' || this._string.charAt(this._currentIndex) === 'E') && (this._string.charAt(this._currentIndex + 1) !== 'x' && this._string.charAt(this._currentIndex + 1) !== 'm')) {
|
if (this._currentIndex !== startIndex && this._currentIndex + 1 < this._endIndex && (this._string.charAt(this._currentIndex) === 'e' || this._string.charAt(this._currentIndex) === 'E') && (this._string.charAt(this._currentIndex + 1) !== 'x' && this._string.charAt(this._currentIndex + 1) !== 'm')) {
|
||||||
this._currentIndex++;
|
this._currentIndex++;
|
||||||
|
|
||||||
// Read the sign of the exponent.
|
// Read the sign of the exponent.
|
||||||
@@ -761,7 +761,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
number *= Math.pow(10, expsign * exponent);
|
number *= Math.pow(10, expsign * exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startIndex == this._currentIndex) {
|
if (startIndex === this._currentIndex) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,13 +791,13 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
|
|||||||
Source.prototype.parseSegment = function () {
|
Source.prototype.parseSegment = function () {
|
||||||
var lookahead = this._string[this._currentIndex];
|
var lookahead = this._string[this._currentIndex];
|
||||||
var command = this._pathSegTypeFromChar(lookahead);
|
var command = this._pathSegTypeFromChar(lookahead);
|
||||||
if (command == window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
if (command === window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
||||||
// Possibly an implicit command. Not allowed if this is the first command.
|
// Possibly an implicit command. Not allowed if this is the first command.
|
||||||
if (this._previousCommand == window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
if (this._previousCommand === window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
command = this._nextCommandHelper(lookahead, this._previousCommand);
|
command = this._nextCommandHelper(lookahead, this._previousCommand);
|
||||||
if (command == window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
if (command === window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq, no-redeclare */
|
/* eslint-disable no-var, no-redeclare */
|
||||||
/* globals $, getRefElem */
|
/* globals $, getRefElem */
|
||||||
/**
|
/**
|
||||||
* Recalculate.
|
* Recalculate.
|
||||||
@@ -98,7 +98,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if this element had no transforms, we are done
|
// if this element had no transforms, we are done
|
||||||
if (!tlist || tlist.numberOfItems == 0) {
|
if (!tlist || tlist.numberOfItems === 0) {
|
||||||
// Chrome has a bug that requires clearing the attribute first.
|
// Chrome has a bug that requires clearing the attribute first.
|
||||||
selected.setAttribute('transform', '');
|
selected.setAttribute('transform', '');
|
||||||
selected.removeAttribute('transform');
|
selected.removeAttribute('transform');
|
||||||
@@ -227,7 +227,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
initial.transform = context_.getStartTransform() || '';
|
initial.transform = context_.getStartTransform() || '';
|
||||||
|
|
||||||
// if it's a regular group, we have special processing to flatten transforms
|
// if it's a regular group, we have special processing to flatten transforms
|
||||||
if ((selected.tagName == 'g' && !gsvg) || selected.tagName === 'a') {
|
if ((selected.tagName === 'g' && !gsvg) || selected.tagName === 'a') {
|
||||||
var box = svgedit.utilities.getBBox(selected),
|
var box = svgedit.utilities.getBBox(selected),
|
||||||
oldcenter = {x: box.x + box.width / 2, y: box.y + box.height / 2},
|
oldcenter = {x: box.x + box.width / 2, y: box.y + box.height / 2},
|
||||||
newcenter = svgedit.math.transformPoint(box.x + box.width / 2,
|
newcenter = svgedit.math.transformPoint(box.x + box.width / 2,
|
||||||
@@ -248,7 +248,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
var i;
|
var i;
|
||||||
for (i = 0; i < tlist.numberOfItems; ++i) {
|
for (i = 0; i < tlist.numberOfItems; ++i) {
|
||||||
var xform = tlist.getItem(i);
|
var xform = tlist.getItem(i);
|
||||||
if (xform.type == 4) {
|
if (xform.type === 4) {
|
||||||
// extract old center through mystical arts
|
// extract old center through mystical arts
|
||||||
var rm = xform.matrix;
|
var rm = xform.matrix;
|
||||||
oldcenter.y = (s * rm.e + rm.f) / 2;
|
oldcenter.y = (s * rm.e + rm.f) / 2;
|
||||||
@@ -267,8 +267,8 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// first, if it was a scale then the second-last transform will be it
|
// first, if it was a scale then the second-last transform will be it
|
||||||
if (N >= 3 && tlist.getItem(N - 2).type == 3 &&
|
if (N >= 3 && tlist.getItem(N - 2).type === 3 &&
|
||||||
tlist.getItem(N - 3).type == 2 && tlist.getItem(N - 1).type == 2) {
|
tlist.getItem(N - 3).type === 2 && tlist.getItem(N - 1).type === 2) {
|
||||||
operation = 3; // scale
|
operation = 3; // scale
|
||||||
|
|
||||||
// if the children are unrotated, pass the scale down directly
|
// if the children are unrotated, pass the scale down directly
|
||||||
@@ -283,7 +283,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
var child = children.item(c);
|
var child = children.item(c);
|
||||||
tx = 0;
|
tx = 0;
|
||||||
ty = 0;
|
ty = 0;
|
||||||
if (child.nodeType == 1) {
|
if (child.nodeType === 1) {
|
||||||
var childTlist = svgedit.transformlist.getTransformList(child);
|
var childTlist = svgedit.transformlist.getTransformList(child);
|
||||||
|
|
||||||
// some children might not have a transform (<metadata>, <defs>, etc)
|
// some children might not have a transform (<metadata>, <defs>, etc)
|
||||||
@@ -375,7 +375,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tlist.removeItem(N - 1);
|
tlist.removeItem(N - 1);
|
||||||
tlist.removeItem(N - 2);
|
tlist.removeItem(N - 2);
|
||||||
tlist.removeItem(N - 3);
|
tlist.removeItem(N - 3);
|
||||||
} else if (N >= 3 && tlist.getItem(N - 1).type == 1) {
|
} else if (N >= 3 && tlist.getItem(N - 1).type === 1) {
|
||||||
operation = 3; // scale
|
operation = 3; // scale
|
||||||
m = svgedit.math.transformListToTransform(tlist).matrix;
|
m = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
var e2t = svgroot.createSVGTransform();
|
var e2t = svgroot.createSVGTransform();
|
||||||
@@ -385,8 +385,8 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// next, check if the first transform was a translate
|
// next, check if the first transform was a translate
|
||||||
// if we had [ T1 ] [ M ] we want to transform this into [ M ] [ T2 ]
|
// if we had [ T1 ] [ M ] we want to transform this into [ M ] [ T2 ]
|
||||||
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ]
|
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ]
|
||||||
} else if ((N == 1 || (N > 1 && tlist.getItem(1).type != 3)) &&
|
} else if ((N === 1 || (N > 1 && tlist.getItem(1).type !== 3)) &&
|
||||||
tlist.getItem(0).type == 2) {
|
tlist.getItem(0).type === 2) {
|
||||||
operation = 2; // translate
|
operation = 2; // translate
|
||||||
var T_M = svgedit.math.transformListToTransform(tlist).matrix;
|
var T_M = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
tlist.removeItem(0);
|
tlist.removeItem(0);
|
||||||
@@ -396,7 +396,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tx = M2.e;
|
tx = M2.e;
|
||||||
ty = M2.f;
|
ty = M2.f;
|
||||||
|
|
||||||
if (tx != 0 || ty != 0) {
|
if (tx !== 0 || ty !== 0) {
|
||||||
// we pass the translates down to the individual children
|
// we pass the translates down to the individual children
|
||||||
var children = selected.childNodes;
|
var children = selected.childNodes;
|
||||||
var c = children.length;
|
var c = children.length;
|
||||||
@@ -438,7 +438,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
var u = uses.length;
|
var u = uses.length;
|
||||||
while (u--) {
|
while (u--) {
|
||||||
var useElem = uses.item(u);
|
var useElem = uses.item(u);
|
||||||
if (href == svgedit.utilities.getHref(useElem)) {
|
if (href === svgedit.utilities.getHref(useElem)) {
|
||||||
var usexlate = svgroot.createSVGTransform();
|
var usexlate = svgroot.createSVGTransform();
|
||||||
usexlate.setTranslate(-tx, -ty);
|
usexlate.setTranslate(-tx, -ty);
|
||||||
svgedit.transformlist.getTransformList(useElem).insertItemBefore(usexlate, 0);
|
svgedit.transformlist.getTransformList(useElem).insertItemBefore(usexlate, 0);
|
||||||
@@ -455,7 +455,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
}
|
}
|
||||||
// else, a matrix imposition from a parent group
|
// else, a matrix imposition from a parent group
|
||||||
// keep pushing it down to the children
|
// keep pushing it down to the children
|
||||||
} else if (N == 1 && tlist.getItem(0).type == 1 && !gangle) {
|
} else if (N === 1 && tlist.getItem(0).type === 1 && !gangle) {
|
||||||
operation = 1;
|
operation = 1;
|
||||||
var m = tlist.getItem(0).matrix,
|
var m = tlist.getItem(0).matrix,
|
||||||
children = selected.childNodes,
|
children = selected.childNodes,
|
||||||
@@ -499,14 +499,14 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tlist.appendItem(newRot);
|
tlist.appendItem(newRot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tlist.numberOfItems == 0) {
|
if (tlist.numberOfItems === 0) {
|
||||||
selected.removeAttribute('transform');
|
selected.removeAttribute('transform');
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it was a translate, put back the rotate at the new center
|
// if it was a translate, put back the rotate at the new center
|
||||||
if (operation == 2) {
|
if (operation === 2) {
|
||||||
if (gangle) {
|
if (gangle) {
|
||||||
newcenter = {
|
newcenter = {
|
||||||
x: oldcenter.x + firstM.e,
|
x: oldcenter.x + firstM.e,
|
||||||
@@ -522,7 +522,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if it was a resize
|
// if it was a resize
|
||||||
} else if (operation == 3) {
|
} else if (operation === 3) {
|
||||||
var m = svgedit.math.transformListToTransform(tlist).matrix;
|
var m = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
var roldt = svgroot.createSVGTransform();
|
var roldt = svgroot.createSVGTransform();
|
||||||
roldt.setRotate(gangle, oldcenter.x, oldcenter.y);
|
roldt.setRotate(gangle, oldcenter.x, oldcenter.y);
|
||||||
@@ -536,14 +536,14 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tx = extrat.e;
|
tx = extrat.e;
|
||||||
ty = extrat.f;
|
ty = extrat.f;
|
||||||
|
|
||||||
if (tx != 0 || ty != 0) {
|
if (tx !== 0 || ty !== 0) {
|
||||||
// now push this transform down to the children
|
// now push this transform down to the children
|
||||||
// we pass the translates down to the individual children
|
// we pass the translates down to the individual children
|
||||||
var children = selected.childNodes;
|
var children = selected.childNodes;
|
||||||
var c = children.length;
|
var c = children.length;
|
||||||
while (c--) {
|
while (c--) {
|
||||||
var child = children.item(c);
|
var child = children.item(c);
|
||||||
if (child.nodeType == 1) {
|
if (child.nodeType === 1) {
|
||||||
var oldStartTransform = context_.getStartTransform();
|
var oldStartTransform = context_.getStartTransform();
|
||||||
context_.setStartTransform(child.getAttribute('transform'));
|
context_.setStartTransform(child.getAttribute('transform'));
|
||||||
var childTlist = svgedit.transformlist.getTransformList(child);
|
var childTlist = svgedit.transformlist.getTransformList(child);
|
||||||
@@ -579,7 +579,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// TODO: Figure out how to get BBox from these elements in case they
|
// TODO: Figure out how to get BBox from these elements in case they
|
||||||
// have a rotation transform
|
// have a rotation transform
|
||||||
|
|
||||||
if (!box && selected.tagName != 'path') return null;
|
if (!box && selected.tagName !== 'path') return null;
|
||||||
|
|
||||||
var m = svgroot.createSVGMatrix(),
|
var m = svgroot.createSVGMatrix(),
|
||||||
// temporarily strip off the rotate and save the old center
|
// temporarily strip off the rotate and save the old center
|
||||||
@@ -598,7 +598,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
}
|
}
|
||||||
for (var i = 0; i < tlist.numberOfItems; ++i) {
|
for (var i = 0; i < tlist.numberOfItems; ++i) {
|
||||||
var xform = tlist.getItem(i);
|
var xform = tlist.getItem(i);
|
||||||
if (xform.type == 4) {
|
if (xform.type === 4) {
|
||||||
// extract old center through mystical arts
|
// extract old center through mystical arts
|
||||||
var rm = xform.matrix;
|
var rm = xform.matrix;
|
||||||
oldcenter.y = (s * rm.e + rm.f) / 2;
|
oldcenter.y = (s * rm.e + rm.f) / 2;
|
||||||
@@ -639,8 +639,8 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// transform will be the [S]
|
// transform will be the [S]
|
||||||
// if we had [M][T][S][T] we want to extract the matrix equivalent of
|
// if we had [M][T][S][T] we want to extract the matrix equivalent of
|
||||||
// [T][S][T] and push it down to the element
|
// [T][S][T] and push it down to the element
|
||||||
if (N >= 3 && tlist.getItem(N - 2).type == 3 &&
|
if (N >= 3 && tlist.getItem(N - 2).type === 3 &&
|
||||||
tlist.getItem(N - 3).type == 2 && tlist.getItem(N - 1).type == 2) {
|
tlist.getItem(N - 3).type === 2 && tlist.getItem(N - 1).type === 2) {
|
||||||
// Removed this so a <use> with a given [T][S][T] would convert to a matrix.
|
// Removed this so a <use> with a given [T][S][T] would convert to a matrix.
|
||||||
// Is that bad?
|
// Is that bad?
|
||||||
// && selected.nodeName != 'use'
|
// && selected.nodeName != 'use'
|
||||||
@@ -651,7 +651,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tlist.removeItem(N - 3);
|
tlist.removeItem(N - 3);
|
||||||
// if we had [T][S][-T][M], then this was a skewed element being resized
|
// if we had [T][S][-T][M], then this was a skewed element being resized
|
||||||
// Thus, we simply combine it all into one matrix
|
// Thus, we simply combine it all into one matrix
|
||||||
} else if (N == 4 && tlist.getItem(N - 1).type == 1) {
|
} else if (N === 4 && tlist.getItem(N - 1).type === 1) {
|
||||||
operation = 3; // scale
|
operation = 3; // scale
|
||||||
m = svgedit.math.transformListToTransform(tlist).matrix;
|
m = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
var e2t = svgroot.createSVGTransform();
|
var e2t = svgroot.createSVGTransform();
|
||||||
@@ -664,8 +664,8 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// if we had [T1][M] we want to transform this into [M][T2]
|
// if we had [T1][M] we want to transform this into [M][T2]
|
||||||
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ] and we can push [T2]
|
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ] and we can push [T2]
|
||||||
// down to the element
|
// down to the element
|
||||||
} else if ((N == 1 || (N > 1 && tlist.getItem(1).type != 3)) &&
|
} else if ((N === 1 || (N > 1 && tlist.getItem(1).type !== 3)) &&
|
||||||
tlist.getItem(0).type == 2) {
|
tlist.getItem(0).type === 2) {
|
||||||
operation = 2; // translate
|
operation = 2; // translate
|
||||||
var oldxlate = tlist.getItem(0).matrix,
|
var oldxlate = tlist.getItem(0).matrix,
|
||||||
meq = svgedit.math.transformListToTransform(tlist, 1).matrix,
|
meq = svgedit.math.transformListToTransform(tlist, 1).matrix,
|
||||||
@@ -674,7 +674,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tlist.removeItem(0);
|
tlist.removeItem(0);
|
||||||
// else if this child now has a matrix imposition (from a parent group)
|
// else if this child now has a matrix imposition (from a parent group)
|
||||||
// we might be able to simplify
|
// we might be able to simplify
|
||||||
} else if (N == 1 && tlist.getItem(0).type == 1 && !angle) {
|
} else if (N === 1 && tlist.getItem(0).type === 1 && !angle) {
|
||||||
// Remap all point-based elements
|
// Remap all point-based elements
|
||||||
m = svgedit.math.transformListToTransform(tlist).matrix;
|
m = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
switch (selected.tagName) {
|
switch (selected.tagName) {
|
||||||
@@ -716,19 +716,19 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
tlist.appendItem(newRot);
|
tlist.appendItem(newRot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tlist.numberOfItems == 0) {
|
if (tlist.numberOfItems === 0) {
|
||||||
selected.removeAttribute('transform');
|
selected.removeAttribute('transform');
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it was a translate or resize, we need to remap the element and absorb the xform
|
// if it was a translate or resize, we need to remap the element and absorb the xform
|
||||||
if (operation == 1 || operation == 2 || operation == 3) {
|
if (operation === 1 || operation === 2 || operation === 3) {
|
||||||
svgedit.coords.remapElement(selected, changes, m);
|
svgedit.coords.remapElement(selected, changes, m);
|
||||||
} // if we are remapping
|
} // if we are remapping
|
||||||
|
|
||||||
// if it was a translate, put back the rotate at the new center
|
// if it was a translate, put back the rotate at the new center
|
||||||
if (operation == 2) {
|
if (operation === 2) {
|
||||||
if (angle) {
|
if (angle) {
|
||||||
if (!svgedit.math.hasMatrixTransform(tlist)) {
|
if (!svgedit.math.hasMatrixTransform(tlist)) {
|
||||||
newcenter = {
|
newcenter = {
|
||||||
@@ -747,12 +747,12 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// We have special processing for tspans: Tspans are not transformable
|
// We have special processing for tspans: Tspans are not transformable
|
||||||
// but they can have x,y coordinates (sigh). Thus, if this was a translate,
|
// but they can have x,y coordinates (sigh). Thus, if this was a translate,
|
||||||
// on a text element, also translate any tspan children.
|
// on a text element, also translate any tspan children.
|
||||||
if (selected.tagName == 'text') {
|
if (selected.tagName === 'text') {
|
||||||
var children = selected.childNodes;
|
var children = selected.childNodes;
|
||||||
var c = children.length;
|
var c = children.length;
|
||||||
while (c--) {
|
while (c--) {
|
||||||
var child = children.item(c);
|
var child = children.item(c);
|
||||||
if (child.tagName == 'tspan') {
|
if (child.tagName === 'tspan') {
|
||||||
var tspanChanges = {
|
var tspanChanges = {
|
||||||
x: $(child).attr('x') || 0,
|
x: $(child).attr('x') || 0,
|
||||||
y: $(child).attr('y') || 0
|
y: $(child).attr('y') || 0
|
||||||
@@ -765,7 +765,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
// we want it to be [Rnew][M][Tr] where Tr is the
|
// we want it to be [Rnew][M][Tr] where Tr is the
|
||||||
// translation required to re-center it
|
// translation required to re-center it
|
||||||
// Therefore, [Tr] = [M_inv][Rnew_inv][Rold][M]
|
// Therefore, [Tr] = [M_inv][Rnew_inv][Rold][M]
|
||||||
} else if (operation == 3 && angle) {
|
} else if (operation === 3 && angle) {
|
||||||
var m = svgedit.math.transformListToTransform(tlist).matrix;
|
var m = svgedit.math.transformListToTransform(tlist).matrix;
|
||||||
var roldt = svgroot.createSVGTransform();
|
var roldt = svgroot.createSVGTransform();
|
||||||
roldt.setRotate(angle, oldcenter.x, oldcenter.y);
|
roldt.setRotate(angle, oldcenter.x, oldcenter.y);
|
||||||
@@ -788,7 +788,7 @@ svgedit.recalculate.recalculateDimensions = function (selected) {
|
|||||||
} // a non-group
|
} // a non-group
|
||||||
|
|
||||||
// if the transform list has been emptied, remove it
|
// if the transform list has been emptied, remove it
|
||||||
if (tlist.numberOfItems == 0) {
|
if (tlist.numberOfItems === 0) {
|
||||||
selected.removeAttribute('transform');
|
selected.removeAttribute('transform');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit */
|
/* globals $, svgedit */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.sanitize
|
* Package: svgedit.sanitize
|
||||||
@@ -104,7 +104,7 @@ $.each(svgWhiteList_, function (elt, atts) {
|
|||||||
var v = att.split(':');
|
var v = att.split(':');
|
||||||
attNS[v[1]] = NS[(v[0]).toUpperCase()];
|
attNS[v[1]] = NS[(v[0]).toUpperCase()];
|
||||||
} else {
|
} else {
|
||||||
attNS[att] = att == 'xmlns' ? NS.XMLNS : null;
|
attNS[att] = att === 'xmlns' ? NS.XMLNS : null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
svgWhiteListNS_[elt] = attNS;
|
svgWhiteListNS_[elt] = attNS;
|
||||||
@@ -118,7 +118,7 @@ $.each(svgWhiteList_, function (elt, atts) {
|
|||||||
// node - The DOM element to be checked (we'll also check its children)
|
// node - The DOM element to be checked (we'll also check its children)
|
||||||
svgedit.sanitize.sanitizeSvg = function (node) {
|
svgedit.sanitize.sanitizeSvg = function (node) {
|
||||||
// Cleanup text nodes
|
// Cleanup text nodes
|
||||||
if (node.nodeType == 3) { // 3 == TEXT_NODE
|
if (node.nodeType === 3) { // 3 == TEXT_NODE
|
||||||
// Trim whitespace
|
// Trim whitespace
|
||||||
node.nodeValue = node.nodeValue.replace(/^\s+|\s+$/g, '');
|
node.nodeValue = node.nodeValue.replace(/^\s+|\s+$/g, '');
|
||||||
// Remove if empty
|
// Remove if empty
|
||||||
@@ -129,7 +129,7 @@ svgedit.sanitize.sanitizeSvg = function (node) {
|
|||||||
|
|
||||||
// We only care about element nodes.
|
// We only care about element nodes.
|
||||||
// Automatically return for all non-element nodes, such as comments, etc.
|
// Automatically return for all non-element nodes, such as comments, etc.
|
||||||
if (node.nodeType != 1) { // 1 == ELEMENT_NODE
|
if (node.nodeType !== 1) { // 1 == ELEMENT_NODE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,8 +156,8 @@ svgedit.sanitize.sanitizeSvg = function (node) {
|
|||||||
var attrNsURI = attr.namespaceURI;
|
var attrNsURI = attr.namespaceURI;
|
||||||
// Check that an attribute with the correct localName in the correct namespace is on
|
// Check that an attribute with the correct localName in the correct namespace is on
|
||||||
// our whitelist or is a namespace declaration for one of our allowed namespaces
|
// our whitelist or is a namespace declaration for one of our allowed namespaces
|
||||||
if (!(allowedAttrsNS.hasOwnProperty(attrLocalName) && attrNsURI == allowedAttrsNS[attrLocalName] && attrNsURI != NS.XMLNS) &&
|
if (!(allowedAttrsNS.hasOwnProperty(attrLocalName) && attrNsURI === allowedAttrsNS[attrLocalName] && attrNsURI !== NS.XMLNS) &&
|
||||||
!(attrNsURI == NS.XMLNS && REVERSE_NS[attr.value])) {
|
!(attrNsURI === NS.XMLNS && REVERSE_NS[attr.value])) {
|
||||||
// TODO(codedread): Programmatically add the se: attributes to the NS-aware whitelist.
|
// TODO(codedread): Programmatically add the se: attributes to the NS-aware whitelist.
|
||||||
// Bypassing the whitelist to allow se: prefixes.
|
// Bypassing the whitelist to allow se: prefixes.
|
||||||
// Is there a more appropriate way to do this?
|
// Is there a more appropriate way to do this?
|
||||||
@@ -180,7 +180,7 @@ svgedit.sanitize.sanitizeSvg = function (node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For the style attribute, rewrite it in terms of XML presentational attributes
|
// For the style attribute, rewrite it in terms of XML presentational attributes
|
||||||
if (attrName == 'style') {
|
if (attrName === 'style') {
|
||||||
var props = attr.value.split(';'),
|
var props = attr.value.split(';'),
|
||||||
p = props.length;
|
p = props.length;
|
||||||
while (p--) {
|
while (p--) {
|
||||||
@@ -207,7 +207,7 @@ svgedit.sanitize.sanitizeSvg = function (node) {
|
|||||||
['filter', 'linearGradient', 'pattern',
|
['filter', 'linearGradient', 'pattern',
|
||||||
'radialGradient', 'textPath', 'use'].indexOf(node.nodeName) >= 0) {
|
'radialGradient', 'textPath', 'use'].indexOf(node.nodeName) >= 0) {
|
||||||
// TODO: we simply check if the first character is a #, is this bullet-proof?
|
// TODO: we simply check if the first character is a #, is this bullet-proof?
|
||||||
if (href[0] != '#') {
|
if (href[0] !== '#') {
|
||||||
// remove the attribute (but keep the element)
|
// remove the attribute (but keep the element)
|
||||||
svgedit.utilities.setHref(node, '');
|
svgedit.utilities.setHref(node, '');
|
||||||
node.removeAttributeNS(NS.XLINK, 'href');
|
node.removeAttributeNS(NS.XLINK, 'href');
|
||||||
@@ -215,7 +215,7 @@ svgedit.sanitize.sanitizeSvg = function (node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Safari crashes on a <use> without a xlink:href, so we just remove the node here
|
// Safari crashes on a <use> without a xlink:href, so we just remove the node here
|
||||||
if (node.nodeName == 'use' && !svgedit.utilities.getHref(node)) {
|
if (node.nodeName === 'use' && !svgedit.utilities.getHref(node)) {
|
||||||
parent.removeChild(node);
|
parent.removeChild(node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit */
|
/* globals $, svgedit */
|
||||||
/**
|
/**
|
||||||
* Package: svedit.select
|
* Package: svedit.select
|
||||||
@@ -458,7 +458,7 @@ svgedit.select.SelectorManager.prototype.releaseSelector = function (elem) {
|
|||||||
console.log('WARNING! selector was released but was already unlocked');
|
console.log('WARNING! selector was released but was already unlocked');
|
||||||
}
|
}
|
||||||
for (i = 0; i < N; ++i) {
|
for (i = 0; i < N; ++i) {
|
||||||
if (this.selectors[i] && this.selectors[i] == sel) {
|
if (this.selectors[i] && this.selectors[i] === sel) {
|
||||||
delete this.selectorMap[elem.id];
|
delete this.selectorMap[elem.id];
|
||||||
sel.locked = false;
|
sel.locked = false;
|
||||||
sel.selectedElement = null;
|
sel.selectedElement = null;
|
||||||
|
|||||||
3259
editor/svgcanvas.js
3259
editor/svgcanvas.js
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit */
|
/* globals $, svgedit */
|
||||||
/**
|
/**
|
||||||
* SVGTransformList
|
* SVGTransformList
|
||||||
@@ -33,7 +33,7 @@ function transformToString (xform) {
|
|||||||
text = 'translate(' + m.e + ',' + m.f + ')';
|
text = 'translate(' + m.e + ',' + m.f + ')';
|
||||||
break;
|
break;
|
||||||
case 3: // SCALE
|
case 3: // SCALE
|
||||||
if (m.a == m.d) {
|
if (m.a === m.d) {
|
||||||
text = 'scale(' + m.a + ')';
|
text = 'scale(' + m.a + ')';
|
||||||
} else {
|
} else {
|
||||||
text = 'scale(' + m.a + ',' + m.d + ')';
|
text = 'scale(' + m.a + ',' + m.d + ')';
|
||||||
@@ -42,7 +42,7 @@ function transformToString (xform) {
|
|||||||
case 4: // ROTATE
|
case 4: // ROTATE
|
||||||
var cx = 0, cy = 0;
|
var cx = 0, cy = 0;
|
||||||
// this prevents divide by zero
|
// this prevents divide by zero
|
||||||
if (xform.angle != 0) {
|
if (xform.angle !== 0) {
|
||||||
var K = 1 - m.a;
|
var K = 1 - m.a;
|
||||||
cy = (K * m.f + m.b * m.e) / (K * K + m.b * m.b);
|
cy = (K * m.f + m.b * m.e) / (K * K + m.b * m.b);
|
||||||
cx = (m.e - m.b * cy) / K;
|
cx = (m.e - m.b * cy) / K;
|
||||||
@@ -114,19 +114,19 @@ svgedit.transformlist.SVGTransformList = function (elem) {
|
|||||||
var mtx = svgroot.createSVGMatrix();
|
var mtx = svgroot.createSVGMatrix();
|
||||||
$.each(valArr, function (i, item) {
|
$.each(valArr, function (i, item) {
|
||||||
valArr[i] = parseFloat(item);
|
valArr[i] = parseFloat(item);
|
||||||
if (name == 'matrix') {
|
if (name === 'matrix') {
|
||||||
mtx[letters[i]] = valArr[i];
|
mtx[letters[i]] = valArr[i];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var xform = svgroot.createSVGTransform();
|
var xform = svgroot.createSVGTransform();
|
||||||
var fname = 'set' + name.charAt(0).toUpperCase() + name.slice(1);
|
var fname = 'set' + name.charAt(0).toUpperCase() + name.slice(1);
|
||||||
var values = name == 'matrix' ? [mtx] : valArr;
|
var values = name === 'matrix' ? [mtx] : valArr;
|
||||||
|
|
||||||
if (name == 'scale' && values.length == 1) {
|
if (name === 'scale' && values.length === 1) {
|
||||||
values.push(values[0]);
|
values.push(values[0]);
|
||||||
} else if (name == 'translate' && values.length == 1) {
|
} else if (name === 'translate' && values.length === 1) {
|
||||||
values.push(0);
|
values.push(0);
|
||||||
} else if (name == 'rotate' && values.length == 1) {
|
} else if (name === 'rotate' && values.length === 1) {
|
||||||
values.push(0, 0);
|
values.push(0, 0);
|
||||||
}
|
}
|
||||||
xform[fname].apply(xform, values);
|
xform[fname].apply(xform, values);
|
||||||
@@ -144,7 +144,7 @@ svgedit.transformlist.SVGTransformList = function (elem) {
|
|||||||
var tl = listMap_[id];
|
var tl = listMap_[id];
|
||||||
var i, len;
|
var i, len;
|
||||||
for (i = 0, len = tl._xforms.length; i < len; ++i) {
|
for (i = 0, len = tl._xforms.length; i < len; ++i) {
|
||||||
if (tl._xforms[i] == item) {
|
if (tl._xforms[i] === item) {
|
||||||
found = true;
|
found = true;
|
||||||
tl.removeItem(i);
|
tl.removeItem(i);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-var, eqeqeq */
|
/* eslint-disable no-var */
|
||||||
/* globals $, svgedit, unescape, DOMParser, ActiveXObject, getStrokedBBox, RGBColor */
|
/* globals $, svgedit, unescape, DOMParser, ActiveXObject, getStrokedBBox, RGBColor */
|
||||||
/**
|
/**
|
||||||
* Package: svgedit.utilities
|
* Package: svgedit.utilities
|
||||||
@@ -148,10 +148,10 @@ svgedit.utilities.decode64 = function (input) {
|
|||||||
|
|
||||||
output = output + String.fromCharCode(chr1);
|
output = output + String.fromCharCode(chr1);
|
||||||
|
|
||||||
if (enc3 != 64) {
|
if (enc3 !== 64) {
|
||||||
output = output + String.fromCharCode(chr2);
|
output = output + String.fromCharCode(chr2);
|
||||||
}
|
}
|
||||||
if (enc4 != 64) {
|
if (enc4 !== 64) {
|
||||||
output = output + String.fromCharCode(chr3);
|
output = output + String.fromCharCode(chr3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ svgedit.utilities.encodeUTF8 = function (argString) {
|
|||||||
* @return {string} object URL or empty string
|
* @return {string} object URL or empty string
|
||||||
*/
|
*/
|
||||||
svgedit.utilities.dataURLToObjectURL = function (dataurl) {
|
svgedit.utilities.dataURLToObjectURL = function (dataurl) {
|
||||||
if (typeof Uint8Array == 'undefined' || typeof Blob == 'undefined' || typeof URL == 'undefined' || !URL.createObjectURL) {
|
if (typeof Uint8Array === 'undefined' || typeof Blob === 'undefined' || typeof URL === 'undefined' || !URL.createObjectURL) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
||||||
@@ -194,7 +194,7 @@ svgedit.utilities.dataURLToObjectURL = function (dataurl) {
|
|||||||
* @return {string} object URL or empty string
|
* @return {string} object URL or empty string
|
||||||
*/
|
*/
|
||||||
svgedit.utilities.createObjectURL = function (blob) {
|
svgedit.utilities.createObjectURL = function (blob) {
|
||||||
if (!blob || typeof URL == 'undefined' || !URL.createObjectURL) {
|
if (!blob || typeof URL === 'undefined' || !URL.createObjectURL) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return URL.createObjectURL(blob);
|
return URL.createObjectURL(blob);
|
||||||
@@ -204,7 +204,7 @@ svgedit.utilities.createObjectURL = function (blob) {
|
|||||||
* @property {string} blankPageObjectURL
|
* @property {string} blankPageObjectURL
|
||||||
*/
|
*/
|
||||||
svgedit.utilities.blankPageObjectURL = (function () {
|
svgedit.utilities.blankPageObjectURL = (function () {
|
||||||
if (typeof Blob == 'undefined') {
|
if (typeof Blob === 'undefined') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
var blob = new Blob(['<html><head><title>SVG-edit</title></head><body> </body></html>'], {type: 'text/html'});
|
var blob = new Blob(['<html><head><title>SVG-edit</title></head><body> </body></html>'], {type: 'text/html'});
|
||||||
@@ -293,7 +293,7 @@ svgedit.utilities.walkTree = function (elem, cbFn) {
|
|||||||
// elem - DOM element to traverse
|
// elem - DOM element to traverse
|
||||||
// cbFn - Callback function to run on each element
|
// cbFn - Callback function to run on each element
|
||||||
svgedit.utilities.walkTreePost = function (elem, cbFn) {
|
svgedit.utilities.walkTreePost = function (elem, cbFn) {
|
||||||
if (elem && elem.nodeType == 1) {
|
if (elem && elem.nodeType === 1) {
|
||||||
var i = elem.childNodes.length;
|
var i = elem.childNodes.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
svgedit.utilities.walkTree(elem.childNodes.item(i), cbFn);
|
svgedit.utilities.walkTree(elem.childNodes.item(i), cbFn);
|
||||||
@@ -412,8 +412,8 @@ svgedit.utilities.getPathBBox = function (path) {
|
|||||||
var a = -3 * P0[j] + 9 * P1[j] - 9 * P2[j] + 3 * P3[j];
|
var a = -3 * P0[j] + 9 * P1[j] - 9 * P2[j] + 3 * P3[j];
|
||||||
var c = 3 * P1[j] - 3 * P0[j];
|
var c = 3 * P1[j] - 3 * P0[j];
|
||||||
|
|
||||||
if (a == 0) {
|
if (a === 0) {
|
||||||
if (b == 0) {
|
if (b === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var t = -c / b;
|
var t = -c / b;
|
||||||
@@ -611,7 +611,7 @@ svgedit.utilities.getPathDFromElement = function (elem) {
|
|||||||
var cx = a.cx, cy = a.cy;
|
var cx = a.cx, cy = a.cy;
|
||||||
rx = a.rx;
|
rx = a.rx;
|
||||||
ry = a.ry;
|
ry = a.ry;
|
||||||
if (elem.tagName == 'circle') {
|
if (elem.tagName === 'circle') {
|
||||||
rx = ry = $(elem).attr('r');
|
rx = ry = $(elem).attr('r');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ svgedit.utilities.getBBoxWithTransform = function (elem, addSvgElementFromJson,
|
|||||||
var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
|
var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
|
||||||
if (elemNames.indexOf(elem.tagName) >= 0) {
|
if (elemNames.indexOf(elem.tagName) >= 0) {
|
||||||
bb = goodBb = svgedit.utilities.getBBoxOfElementAsPath(elem, addSvgElementFromJson, pathActions);
|
bb = goodBb = svgedit.utilities.getBBoxOfElementAsPath(elem, addSvgElementFromJson, pathActions);
|
||||||
} else if (elem.tagName == 'rect') {
|
} else if (elem.tagName === 'rect') {
|
||||||
// Look for radius
|
// Look for radius
|
||||||
var rx = elem.getAttribute('rx');
|
var rx = elem.getAttribute('rx');
|
||||||
var ry = elem.getAttribute('ry');
|
var ry = elem.getAttribute('ry');
|
||||||
@@ -912,7 +912,7 @@ svgedit.utilities.getBBoxWithTransform = function (elem, addSvgElementFromJson,
|
|||||||
// TODO: This is problematic with large stroke-width and, for example, a single horizontal line. The calculated BBox extends way beyond left and right sides.
|
// TODO: This is problematic with large stroke-width and, for example, a single horizontal line. The calculated BBox extends way beyond left and right sides.
|
||||||
function getStrokeOffsetForBBox (elem) {
|
function getStrokeOffsetForBBox (elem) {
|
||||||
var sw = elem.getAttribute('stroke-width');
|
var sw = elem.getAttribute('stroke-width');
|
||||||
return (!isNaN(sw) && elem.getAttribute('stroke') != 'none') ? sw / 2 : 0;
|
return (!isNaN(sw) && elem.getAttribute('stroke') !== 'none') ? sw / 2 : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function: getStrokedBBox
|
// Function: getStrokedBBox
|
||||||
@@ -961,7 +961,7 @@ svgedit.utilities.getStrokedBBox = function (elems, addSvgElementFromJson, pathA
|
|||||||
minX = Math.min(minX, curBb.x - offset);
|
minX = Math.min(minX, curBb.x - offset);
|
||||||
minY = Math.min(minY, curBb.y - offset);
|
minY = Math.min(minY, curBb.y - offset);
|
||||||
// TODO: The old code had this test for max, but not min. I suspect this test should be for both min and max
|
// TODO: The old code had this test for max, but not min. I suspect this test should be for both min and max
|
||||||
if (elem.nodeType == 1) {
|
if (elem.nodeType === 1) {
|
||||||
maxX = Math.max(maxX, curBb.x + curBb.width + offset);
|
maxX = Math.max(maxX, curBb.x + curBb.width + offset);
|
||||||
maxY = Math.max(maxY, curBb.y + curBb.height + offset);
|
maxY = Math.max(maxY, curBb.y + curBb.height + offset);
|
||||||
}
|
}
|
||||||
@@ -991,7 +991,7 @@ svgedit.utilities.getRotationAngleFromTransformList = function (tlist, toRad) {
|
|||||||
var i;
|
var i;
|
||||||
for (i = 0; i < N; ++i) {
|
for (i = 0; i < N; ++i) {
|
||||||
var xform = tlist.getItem(i);
|
var xform = tlist.getItem(i);
|
||||||
if (xform.type == 4) {
|
if (xform.type === 4) {
|
||||||
return toRad ? xform.angle * Math.PI / 180.0 : xform.angle;
|
return toRad ? xform.angle * Math.PI / 180.0 : xform.angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1104,7 +1104,7 @@ svgedit.utilities.cleanupElement = function (element) {
|
|||||||
var attr;
|
var attr;
|
||||||
for (attr in defaults) {
|
for (attr in defaults) {
|
||||||
var val = defaults[attr];
|
var val = defaults[attr];
|
||||||
if (element.getAttribute(attr) == val) {
|
if (element.getAttribute(attr) === String(val)) {
|
||||||
element.removeAttribute(attr);
|
element.removeAttribute(attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1183,7 +1183,7 @@ svgedit.utilities.copyElem = function (el, getNextId) {
|
|||||||
// manually create a copy of the element
|
// manually create a copy of the element
|
||||||
var newEl = document.createElementNS(el.namespaceURI, el.nodeName);
|
var newEl = document.createElementNS(el.namespaceURI, el.nodeName);
|
||||||
$.each(el.attributes, function (i, attr) {
|
$.each(el.attributes, function (i, attr) {
|
||||||
if (attr.localName != '-moz-math-font-style') {
|
if (attr.localName !== '-moz-math-font-style') {
|
||||||
newEl.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value);
|
newEl.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1193,7 +1193,7 @@ svgedit.utilities.copyElem = function (el, getNextId) {
|
|||||||
|
|
||||||
// Opera's "d" value needs to be reset for Opera/Win/non-EN
|
// Opera's "d" value needs to be reset for Opera/Win/non-EN
|
||||||
// Also needed for webkit (else does not keep curved segments on clone)
|
// Also needed for webkit (else does not keep curved segments on clone)
|
||||||
if (svgedit.browser.isWebkit() && el.nodeName == 'path') {
|
if (svgedit.browser.isWebkit() && el.nodeName === 'path') {
|
||||||
var fixedD = svgedit.utilities.convertPath(el);
|
var fixedD = svgedit.utilities.convertPath(el);
|
||||||
newEl.setAttribute('d', fixedD);
|
newEl.setAttribute('d', fixedD);
|
||||||
}
|
}
|
||||||
@@ -1217,7 +1217,7 @@ svgedit.utilities.copyElem = function (el, getNextId) {
|
|||||||
} else if ($(el).data('symbol')) {
|
} else if ($(el).data('symbol')) {
|
||||||
var ref = $(el).data('symbol');
|
var ref = $(el).data('symbol');
|
||||||
$(newEl).data('ref', ref).data('symbol', ref);
|
$(newEl).data('ref', ref).data('symbol', ref);
|
||||||
} else if (newEl.tagName == 'image') {
|
} else if (newEl.tagName === 'image') {
|
||||||
svgedit.utilities.preventClickDefault(newEl);
|
svgedit.utilities.preventClickDefault(newEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ svgedit.units.getTypeMap = function () {
|
|||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// If a string/number was given, returns a Float. If an array, return a string
|
// If a string/number was given, returns a Float. If an array, return a string
|
||||||
// with comma-seperated floats
|
// with comma-separated floats
|
||||||
svgedit.units.shortFloat = function (val) {
|
svgedit.units.shortFloat = function (val) {
|
||||||
var digits = elementContainer_.getRoundDigits();
|
var digits = elementContainer_.getRoundDigits();
|
||||||
if (!isNaN(val)) {
|
if (!isNaN(val)) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ msgstr ""
|
|||||||
def printstr(flag, i, s):
|
def printstr(flag, i, s):
|
||||||
out.append('\n')
|
out.append('\n')
|
||||||
if flag == '-x-svg-edit-both':
|
if flag == '-x-svg-edit-both':
|
||||||
out.append("# Enter the title first, then the contents, seperated by a pipe char (|)\n")
|
out.append("# Enter the title first, then the contents, separated by a pipe char (|)\n")
|
||||||
out.append("#, " + flag + '\n')
|
out.append("#, " + flag + '\n')
|
||||||
out.append("msgid \"" + i + "\"" + '\n')
|
out.append("msgid \"" + i + "\"" + '\n')
|
||||||
out.append("msgstr \"" + s.replace('\n', '\\n') + "\"" + '\n')
|
out.append("msgstr \"" + s.replace('\n', '\\n') + "\"" + '\n')
|
||||||
@@ -36,4 +36,4 @@ for line in infile:
|
|||||||
pass # The line wasn't really a string
|
pass # The line wasn't really a string
|
||||||
|
|
||||||
outfile.writelines(out)
|
outfile.writelines(out)
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user