Browse Source

Change units on resizing to pixels

pull/3220/head
Dmytro Bartieniev 5 years ago
parent
commit
cb705986bd
  1. 13
      src/commands/view/SelectComponent.js

13
src/commands/view/SelectComponent.js

@ -463,14 +463,7 @@ export default {
}
const { store, selectedHandler, config } = options;
const {
keyHeight,
keyWidth,
autoHeight,
autoWidth,
unitWidth,
unitHeight
} = config;
const { keyHeight, keyWidth, autoHeight, autoWidth } = config;
const onlyHeight = ['tc', 'bc'].indexOf(selectedHandler) >= 0;
const onlyWidth = ['cl', 'cr'].indexOf(selectedHandler) >= 0;
const style = {};
@ -479,11 +472,11 @@ export default {
if (!onlyHeight) {
const bodyw = canvas.getBody().offsetWidth;
const width = rect.w < bodyw ? rect.w : bodyw;
style[keyWidth] = autoWidth ? 'auto' : `${width}${unitWidth}`;
style[keyWidth] = autoWidth ? 'auto' : `${width}px`;
}
if (!onlyWidth) {
style[keyHeight] = autoHeight ? 'auto' : `${rect.h}${unitHeight}`;
style[keyHeight] = autoHeight ? 'auto' : `${rect.h}px`;
}
modelToStyle.addStyle({ ...style, en }, { avoidStore: !store });

Loading…
Cancel
Save