[TextLayer] Only cache the current textDiv style when enhanceTextSelection is enabled
				
					
				
			This will help save a little bit of memory, by not storing one unused string for each `textDiv` in regular text-selection mode.
This commit is contained in:
		
							parent
							
								
									852fc955bd
								
							
						
					
					
						commit
						45dfad8640
					
				| @ -90,8 +90,7 @@ var renderTextLayer = (function renderTextLayerClosure() { | ||||
|       fontAscent = (1 + style.descent) * fontAscent; | ||||
|     } | ||||
| 
 | ||||
|     var left; | ||||
|     var top; | ||||
|     let left, top; | ||||
|     if (angle === 0) { | ||||
|       left = tx[4]; | ||||
|       top = tx[5] - fontAscent; | ||||
| @ -103,8 +102,12 @@ var renderTextLayer = (function renderTextLayerClosure() { | ||||
|     styleBuf[3] = top; | ||||
|     styleBuf[5] = fontHeight; | ||||
|     styleBuf[7] = style.fontFamily; | ||||
|     textDivProperties.style = styleBuf.join(''); | ||||
|     textDiv.setAttribute('style', textDivProperties.style); | ||||
|     const styleStr = styleBuf.join(''); | ||||
| 
 | ||||
|     if (task._enhanceTextSelection) { | ||||
|       textDivProperties.style = styleStr; | ||||
|     } | ||||
|     textDiv.setAttribute('style', styleStr); | ||||
| 
 | ||||
|     textDiv.textContent = geom.str; | ||||
|     // `fontName` is only used by the FontInspector, and we only use `dataset`
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user