refactor(changes): allow set attributes to be width or height
This commit is contained in:
@@ -118,11 +118,12 @@ function ResizeControl({
|
||||
}
|
||||
|
||||
if (change.width !== undefined && change.height !== undefined) {
|
||||
const setAttributes = !resizeDirection ? true : resizeDirection === 'horizontal' ? 'width' : 'height';
|
||||
const dimensionChange: NodeDimensionChange = {
|
||||
id,
|
||||
type: 'dimensions',
|
||||
resizing: true,
|
||||
setAttributes: true,
|
||||
setAttributes,
|
||||
dimensions: {
|
||||
width: change.width,
|
||||
height: change.height,
|
||||
|
||||
@@ -130,8 +130,12 @@ function applyChange(change: any, element: any): any {
|
||||
element.measured.height = change.dimensions.height;
|
||||
|
||||
if (change.setAttributes) {
|
||||
element.width = change.dimensions.width;
|
||||
element.height = change.dimensions.height;
|
||||
if (change.setAttributes === true || change.setAttributes === 'width') {
|
||||
element.width = change.dimensions.width;
|
||||
}
|
||||
if (change.setAttributes === true || change.setAttributes === 'height') {
|
||||
element.height = change.dimensions.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user