mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Clean up/
This commit is contained in:
parent
893f85bdfe
commit
e893cb1325
2 changed files with 4 additions and 5 deletions
|
@ -140,7 +140,6 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function importGradient(node, type) {
|
function importGradient(node, type) {
|
||||||
debugger;
|
|
||||||
var id = (getValue(node, 'href', true) || '').substring(1),
|
var id = (getValue(node, 'href', true) || '').substring(1),
|
||||||
radial = type === 'radialgradient',
|
radial = type === 'radialgradient',
|
||||||
gradient;
|
gradient;
|
||||||
|
|
|
@ -105,7 +105,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
var rect = options.drawnTextBounds ? this._getDrawnTextSize() : this._getMeasuredTextSize();
|
var rect = options.drawnTextBounds ? this._getDrawnTextSize() : this._getMeasuredTextSize();
|
||||||
return matrix ? matrix._transformBounds(rect, rect) : rect;
|
return matrix ? matrix._transformBounds(rect, rect) : rect;
|
||||||
},
|
},
|
||||||
_getMeasuredTextSize () {
|
_getMeasuredTextSize: function() {
|
||||||
var style = this._style,
|
var style = this._style,
|
||||||
lines = this._lines,
|
lines = this._lines,
|
||||||
numLines = lines.length,
|
numLines = lines.length,
|
||||||
|
@ -122,7 +122,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
numLines ? - 0.75 * leading : 0,
|
numLines ? - 0.75 * leading : 0,
|
||||||
width, numLines * leading);
|
width, numLines * leading);
|
||||||
},
|
},
|
||||||
_getDrawnTextSize () {
|
_getDrawnTextSize: function() {
|
||||||
var numLines = this._lines.length;
|
var numLines = this._lines.length;
|
||||||
var leading = this._style.getLeading();
|
var leading = this._style.getLeading();
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
xmlns: SvgElement.svg
|
xmlns: SvgElement.svg
|
||||||
});
|
});
|
||||||
var node = SvgElement.create('text');
|
var node = SvgElement.create('text');
|
||||||
node.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve')
|
node.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||||
svg.appendChild(node);
|
svg.appendChild(node);
|
||||||
for (var i = 0; i < numLines; i++) {
|
for (var i = 0; i < numLines; i++) {
|
||||||
var tspanNode = SvgElement.create('tspan', {
|
var tspanNode = SvgElement.create('tspan', {
|
||||||
|
@ -147,7 +147,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
var element = document.createElement('span');
|
var element = document.createElement('span');
|
||||||
element.style.visibility = ('hidden');
|
element.style.visibility = ('hidden');
|
||||||
element.style.whiteSpace = 'pre';
|
element.style.whiteSpace = 'pre';
|
||||||
element.style.fontSize = `${this.fontSize}px`;
|
element.style.fontSize = this.fontSize + 'px';
|
||||||
element.style.fontFamily = this.font;
|
element.style.fontFamily = this.font;
|
||||||
element.style.lineHeight = this.leading / this.fontSize;
|
element.style.lineHeight = this.leading / this.fontSize;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue