fix:限制最小可缩宽度

This commit is contained in:
CPPAlien 2019-11-22 10:13:17 +08:00
parent e4b6c11e12
commit 5c59e27272
2 changed files with 13 additions and 0 deletions

View File

@ -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') {

View File

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