diff --git a/lib/pen.js b/lib/pen.js index d14617d..10ec8b1 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -343,6 +343,9 @@ export default class Painter { view.rect.top = view.rect.top - pd[0]; view.rect.right = view.rect.right + pd[1]; view.rect.bottom = view.rect.bottom + pd[2]; + if (view.type === 'text') { + view.rect.minWidth = view.css.fontSize.toPx() + pd[1] + pd[3]; + } this.ctx.rotate(angle); if (!notClip && view.css && view.css.borderRadius && view.type !== 'rect') { diff --git a/painter.js b/painter.js index dff7a26..c03c9d4 100644 --- a/painter.js +++ b/painter.js @@ -462,6 +462,16 @@ Component({ let css = {} if (this.isScale) { const newW = this.startW + offsetX > 1 ? this.startW + offsetX : 1 + if (this.touchedView.css && this.touchedView.css.minWidth) { + if (newW < this.touchedView.css.minWidth.toPx()) { + return + } + } + if (this.touchedView.rect && this.touchedView.rect.minWidth) { + if (newW < this.touchedView.rect.minWidth) { + return + } + } const newH = this.startH + offsetY > 1 ? this.startH + offsetY : 1 css = { width: `${newW}px`,