From 932fcacff863041ef4aa91eab7dc53f73551b463 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 22 Aug 2019 17:35:48 +0200 Subject: [PATCH] [TextLayer] Only handle positive padding values in `expandTextDivs` Given that browsers will reject padding values smaller than zero (which may be caused by limited numerical precision during calculations in the `expand` code), it makes no sense to include those when expanding the `textDiv`s. --- src/display/text_layer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/display/text_layer.js b/src/display/text_layer.js index 4ceb22aa2..a0e3ea717 100644 --- a/src/display/text_layer.js +++ b/src/display/text_layer.js @@ -643,21 +643,21 @@ var renderTextLayer = (function renderTextLayerClosure() { if (divProps.angle !== 0) { transform = `rotate(${divProps.angle}deg) ${transform}`; } - if (divProps.paddingLeft !== 0) { + if (divProps.paddingLeft > 0) { padding += ` padding-left: ${divProps.paddingLeft / divProps.scale}px;`; transform += ` translateX(${-divProps.paddingLeft / divProps.scale}px)`; } - if (divProps.paddingTop !== 0) { + if (divProps.paddingTop > 0) { padding += ` padding-top: ${divProps.paddingTop}px;`; transform += ` translateY(${-divProps.paddingTop}px)`; } - if (divProps.paddingRight !== 0) { + if (divProps.paddingRight > 0) { padding += ` padding-right: ${divProps.paddingRight / divProps.scale}px;`; } - if (divProps.paddingBottom !== 0) { + if (divProps.paddingBottom > 0) { padding += ` padding-bottom: ${divProps.paddingBottom}px;`; }