From c19d0b77b593150dd467e82af1a0341c61f84a6c Mon Sep 17 00:00:00 2001 From: Muhsin Shah C P Date: Thu, 13 Jan 2022 16:52:58 +0530 Subject: [PATCH] Query manager panel resizes smoothly (#1812) * jumbing problem fixed with smooth transition * now query panel can be drag using the border * removed css transition --- frontend/src/Editor/Editor.jsx | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 1010e8cd9a..3d610ab777 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -72,6 +72,7 @@ class Editor extends React.Component { allComponentTypes: componentTypes, isQueryPaneDragging: false, queryPaneHeight: 70, + isTopOfQueryPane: false, isLoading: true, users: null, appId, @@ -117,8 +118,21 @@ class Editor extends React.Component { } onMouseMove = (e) => { + const componentTop = Math.round(this.queryPaneRef.current.getBoundingClientRect().top); + const clientY = e.clientY; + + if ((clientY >= componentTop) & (clientY <= componentTop + 5)) { + this.setState({ + isTopOfQueryPane: true, + }); + } else { + this.setState({ + isTopOfQueryPane: false, + }); + } + if (this.state.isQueryPaneDragging) { - let queryPaneHeight = (e.clientY / window.screen.height) * 100; + let queryPaneHeight = (clientY / window.innerHeight) * 100; if (queryPaneHeight > 95) queryPaneHeight = 100; if (queryPaneHeight < 4.5) queryPaneHeight = 4.5; @@ -965,21 +979,13 @@ class Editor extends React.Component { ref={this.queryPaneRef} onTouchEnd={this.onMouseUp} onMouseDown={this.onMouseDown} - className="query-pane" - style={{ - height: `calc(100% - ${this.state.queryPaneHeight - 1}%)`, - background: 'transparent', - border: 0, - cursor: 'row-resize', - }} - > -