Browse Source
Merge pull request #1736 from arthuralmeidap/resize-components-canvas Closes #1737
limit width resize to Canvas width
pull/1755/head
Artur Arseniev
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
2 deletions
-
src/commands/view/SelectComponent.js
|
|
|
@ -350,7 +350,7 @@ module.exports = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
initResize(elem) { |
|
|
|
const em = this.em; |
|
|
|
const { em, canvas } = this; |
|
|
|
const editor = em ? em.get('Editor') : ''; |
|
|
|
const config = em ? em.get('Config') : ''; |
|
|
|
const pfx = config.stylePrefix || ''; |
|
|
|
@ -444,7 +444,13 @@ module.exports = { |
|
|
|
const style = modelToStyle.getStyle(); |
|
|
|
|
|
|
|
if (!onlyHeight) { |
|
|
|
style[keyWidth] = autoWidth ? 'auto' : `${rect.w}${unitWidth}`; |
|
|
|
const padding = 10; |
|
|
|
const frameOffset = canvas.getCanvasView().getFrameOffset(); |
|
|
|
const width = |
|
|
|
rect.w < frameOffset.width - padding |
|
|
|
? rect.w |
|
|
|
: frameOffset.width - padding; |
|
|
|
style[keyWidth] = autoWidth ? 'auto' : `${width}${unitWidth}`; |
|
|
|
} |
|
|
|
|
|
|
|
if (!onlyWidth) { |
|
|
|
|