From 4d2b12c292e464d0dd3792aa4b542159230c1e2a Mon Sep 17 00:00:00 2001 From: irismarie Date: Thu, 5 Nov 2020 10:21:49 +0100 Subject: [PATCH] Rnd has multiple children now, ref can point to sth. else --- src/widget/editable-widget-container.js | 39 ++----------------------- src/widget/widget-context-menu.js | 6 ++-- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/widget/editable-widget-container.js b/src/widget/editable-widget-container.js index b5fb964..65770ab 100644 --- a/src/widget/editable-widget-container.js +++ b/src/widget/editable-widget-container.js @@ -76,28 +76,16 @@ class EditableWidgetContainer extends React.Component { /* hand over new dimensions to child element so that the rotation is displayed correctly * already before the dashboard changes are saved - */ + if (this.props.widget.type === 'Line') { this.refs.child0.illustrateDuringEdit(widget.width, widget.height); - } + }*/ }; render() { const widget = this.props.widget; - let isLine = false; let children = null; - // clone WidgetLine child element so that it can be referenced while resizing - if (widget.type === 'Line') { - isLine = true; - - children = React.Children.map(this.props.children, - (child, index) => React.cloneElement(child, { - ref: `child${index}` - }) - ); - } - let resizingRestricted = false; if (widget.customProperties.resizeRightLeftLock || widget.customProperties.resizeTopBottomLock) { resizingRestricted = true; @@ -122,29 +110,6 @@ class EditableWidgetContainer extends React.Component { 'locked': widget.isLocked }); - if (isLine) { - return { this.rnd = c; }} - default={{ x: Number(widget.x), y: Number(widget.y), width: widget.width, height: widget.height }} - minWidth={widget.minWidth} - minHeight={widget.minHeight} - maxWidth={widget.customProperties.maxWidth || '100%'} - lockAspectRatio={Boolean(widget.customProperties.lockAspect)} - bounds={'parent'} - className={widgetClasses} - onResizeStart={this.borderWasClicked} - onResizeStop={this.resizeStop} - onDragStop={this.dragStop} - dragGrid={gridArray} - resizeGrid={gridArray} - zindex={widget.z} - enableResizing={resizing} - disableDragging={widget.isLocked} - > - {children} - ; - } - return { this.rnd = c; }} default={{ x: Number(widget.x), y: Number(widget.y), width: widget.width, height: widget.height }} diff --git a/src/widget/widget-context-menu.js b/src/widget/widget-context-menu.js index 5bb1357..d79f869 100644 --- a/src/widget/widget-context-menu.js +++ b/src/widget/widget-context-menu.js @@ -90,7 +90,7 @@ class WidgetContextMenu extends React.Component { render() { const isLocked = this.props.widget.locked; const ContextMenu = () => ( - + Edit Delete @@ -108,8 +108,8 @@ class WidgetContextMenu extends React.Component { ); - return
- + return
+