@@ -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