From 8292aae00bb7fd7716110df21faafa53fd35738d Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Thu, 25 Jun 2020 17:28:21 -0500 Subject: menu text selection and more movement tweaks --- src/client/views/collections/CollectionSchemaView.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 128423014..9cd13058f 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -349,12 +349,18 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { return this.props.ScreenToLocalTransform().translate(- this.borderWidth - NumCast(COLLECTION_BORDER_WIDTH) - this.tableWidth, - this.borderWidth); } + @action + onHeaderClick = (e: React.PointerEvent) => { + this.props.active(true); + e.stopPropagation(); + } + @action onWheel(e: React.WheelEvent) { const scale = this.props.ScreenToLocalTransform().Scale; this.props.active(true) && e.stopPropagation(); - this.menuCoordinates[0] += e.screenX * scale; - this.menuCoordinates[1] += e.screenY * scale; + this.menuCoordinates[0] -= e.screenX / scale; + this.menuCoordinates[1] -= e.screenY / scale; } @computed get renderMenu() { @@ -362,9 +368,10 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { return (
this.props.active(true) && e.stopPropagation()} + onPointerDown={e => this.onHeaderClick(e)} style={{ position: "absolute", background: "white", - transform: `translate(${this.menuCoordinates[0]}px, ${this.menuCoordinates[1] - 100 / scale}px)` + transform: `translate(${this.menuCoordinates[0] * scale}px, ${this.menuCoordinates[1] / scale}px)` }}> { const dim = this.props.ScreenToLocalTransform().inverse().transformDirection(r.offset.width, r.offset.height); -- cgit v1.2.3-70-g09d2