diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-25 17:28:21 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-25 17:28:21 -0500 |
commit | 8292aae00bb7fd7716110df21faafa53fd35738d (patch) | |
tree | 7c4489c67b8f204d6dd8d1945de70676cec7d990 | |
parent | 381a2b87a7dd9d6e3629d89dec692a8e5d9d0662 (diff) |
menu text selection and more movement tweaks
-rw-r--r-- | src/client/views/collections/CollectionSchemaView.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
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 @@ -350,11 +350,17 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { } @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 ( <div className="collectionSchema-header-menu" ref={this.setNode} onWheel={e => 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)` }}> <Measure offset onResize={action((r: any) => { const dim = this.props.ScreenToLocalTransform().inverse().transformDirection(r.offset.width, r.offset.height); |