Skip to content

Commit 4a03e90

Browse files
committed
DVF-2506-nodejs-integration
1 parent 6c7dca0 commit 4a03e90

File tree

6 files changed

+13
-74
lines changed

6 files changed

+13
-74
lines changed

src/acgraph.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ acgraph.updateReferences = function() {
536536

537537
//exports
538538
goog.exportSymbol('acgraph.create', acgraph.create);
539-
goog.exportSymbol('acgraph.getRenderer', acgraph.getRenderer);
540539
goog.exportSymbol('acgraph.type', acgraph.type);
541540
goog.exportSymbol('acgraph.server', acgraph.server);
542541
goog.exportSymbol('acgraph.StageType.SVG', acgraph.StageType.SVG);

src/vector/Defs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ acgraph.vector.Defs.prototype.disposeInternal = function() {
303303
acgraph.getRenderer().removeNode(this.domElement_);
304304
this.domElement_ = null;
305305

306-
this.linearGradients_ = null;
306+
goog.disposeAll(this.linearGradients_);
307+
goog.disposeAll(this.radialGradients_);
308+
goog.disposeAll(this.imageFills_);
309+
// goog.disposeAll(this.hatchFills_);
310+
307311
delete this.stage;
308312
};

src/vector/HatchFill.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,10 @@ acgraph.vector.HatchFill.prototype.getElementTypePrefix = function() {
605605
//----------------------------------------------------------------------------------------------------------------------
606606
/** @inheritDoc */
607607
acgraph.vector.HatchFill.prototype.disposeInternal = function() {
608+
goog.base(this, 'disposeInternal');
609+
608610
if (this.getStage())
609611
this.getStage().getDefs().removeHatchFill(this);
610-
goog.base(this, 'disposeInternal');
611612
};
612613

613614

src/vector/Renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ acgraph.vector.Renderer.prototype.isImageLoading = function() {
561561
*/
562562
acgraph.vector.Renderer.prototype.getImageLoader = function() {
563563
if (!this.imageLoader_)
564-
this.imageLoader_ = new goog.net.ImageLoader(/** @type {Element} */(document.body));
564+
this.imageLoader_ = new goog.net.ImageLoader(/** @type {Element} */(goog.global['document']['body']));
565565
return this.imageLoader_;
566566
};
567567

src/vector/Stage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,11 @@ acgraph.vector.Stage.prototype.disposeInternal = function() {
27502750
this.domElement_ = null;
27512751
this.container_ = null;
27522752
this.originContainer_ = null;
2753+
2754+
if (this.credits_) {
2755+
this.credits_.dispose();
2756+
this.credits_ = null;
2757+
}
27532758
};
27542759

27552760

src/vector/svg/Renderer.js

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,6 @@ acgraph.vector.svg.Renderer.prototype.createMeasurement_ = function() {
178178

179179
this.measurementGroupNode_ = this.createLayerElement();
180180
goog.dom.appendChild(this.measurement_, this.measurementGroupNode_);
181-
182-
183-
184-
this.measurement_ex = goog.dom.createDom(goog.dom.TagName.DIV);
185-
this.virtualBaseLine_ = goog.dom.createDom(goog.dom.TagName.SPAN);
186-
this.measurementText_ex = goog.dom.createDom(goog.dom.TagName.SPAN);
187-
188-
goog.style.setStyle(this.measurement_ex, {'position': 'absolute', 'visibility': 'hidden', 'left': 0, 'top': 0});
189-
goog.style.setStyle(this.measurementText_ex, {'font-size': '0px', 'border': '0 solid'});
190-
this.measurementText_ex.innerHTML = 'a';
191-
goog.style.setStyle(this.virtualBaseLine_, {'font-size': '0px', 'border': '0 solid'});
192-
this.virtualBaseLine_.innerHTML = 'a';
193-
194-
goog.dom.appendChild(document.body, this.measurement_ex);
195-
goog.dom.appendChild(this.measurement_ex, this.virtualBaseLine_);
196-
goog.dom.appendChild(this.measurement_ex, this.measurementText_ex);
197181
};
198182

199183

@@ -260,60 +244,10 @@ acgraph.vector.svg.Renderer.prototype.measure = function(text, style) {
260244
bbox.height = this.measurementText_['getBBox']().height;
261245
}
262246

263-
// var bbox_html = this.measuringHTMLText(text, style);
264-
// console.log(bbox_html);
265-
// console.log(bbox);
266-
267-
// return bbox_html;
268247
return new acgraph.math.Rect(bbox.x, bbox.y, bbox.width + additionWidth, bbox.height);
269248
};
270249

271250

272-
/**
273-
* Measure simple text.
274-
* @param {string} text The text to measure.
275-
* @param {Object} style The style of text.
276-
* @return {acgraph.math.Rect} Text bounds.
277-
*/
278-
acgraph.vector.svg.Renderer.prototype.measuringHTMLText = function(text, style) {
279-
this.measurementText_ex.style.cssText = '';
280-
281-
if (style['fontStyle']) goog.style.setStyle(this.measurementText_ex, 'font-style', style['fontStyle']);
282-
if (style['fontVariant']) goog.style.setStyle(this.measurementText_ex, 'font-variant', style['fontVariant']);
283-
if (style['fontFamily']) goog.style.setStyle(this.measurementText_ex, 'font-family', style['fontFamily']);
284-
if (style['fontSize']) goog.style.setStyle(this.measurementText_ex, 'font-size', style['fontSize']);
285-
if (style['fontWeight']) goog.style.setStyle(this.measurementText_ex, 'font-weight', style['fontWeight']);
286-
if (style['letterSpacing']) goog.style.setStyle(this.measurementText_ex, 'letter-spacing', style['letterSpacing']);
287-
if (style['decoration']) goog.style.setStyle(this.measurementText_ex, 'text-decoration', style['decoration']);
288-
if (style['textIndent']) goog.style.setStyle(this.measurementText_ex, 'text-indent', style['textIndent']);
289-
290-
if (style['textWrap'] && style['width'] && style['textWrap'] == acgraph.vector.Text.TextWrap.BY_LETTER) {
291-
goog.style.setStyle(this.measurementText_ex, 'word-break', 'break-all');
292-
} else {
293-
goog.style.setStyle(this.measurementText_ex, 'white-space', 'nowrap');
294-
}
295-
if (style['width']) goog.style.setStyle(this.measurementText_ex, 'width', style['width']);
296-
297-
goog.style.setStyle(this.measurement_ex, {'left': 0, 'top': 0, 'width': 'auto', 'height': 'auto'});
298-
// goog.style.setStyle(this.measurementText_ex, {
299-
// 'border': '0 solid',
300-
// 'position': 'absolute',
301-
// 'left': 0,
302-
// 'top': 0
303-
// });
304-
305-
this.measurementText_ex.innerHTML = text;
306-
307-
var boundsMicroText = goog.style.getBounds(this.virtualBaseLine_);
308-
goog.style.setPosition(this.measurement_ex, 0, -(boundsMicroText.top + boundsMicroText.height));
309-
310-
var boundsTargetText = goog.style.getBounds(this.measurementText_ex);
311-
this.measurementText_ex.innerHTML = '';
312-
313-
return boundsTargetText;
314-
};
315-
316-
317251
/**
318252
* Measure any svg nodes.
319253
* @param {string|Node} element .
@@ -1512,7 +1446,3 @@ acgraph.vector.svg.Renderer.prototype.setPrintAttributes = function(element, sta
15121446
goog.style.setStyle(element, 'height', '');
15131447
goog.style.setStyle(element, 'max-height', '100%');
15141448
};
1515-
1516-
1517-
//exports
1518-
acgraph.vector.svg.Renderer.prototype['measuringHTMLText'] = acgraph.vector.svg.Renderer.prototype.measuringHTMLText;

0 commit comments

Comments
 (0)