From 6d8c85aacba7d9ccdedfb85b838e84ad914e6081 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sat, 29 Jun 2024 19:07:27 -0400 Subject: highlight updates properly when highlighted cell is selected; no longer possible to add EmptyKey to equation --- .../collections/collectionSchema/CollectionSchemaView.tsx | 13 +++++++------ .../views/collections/collectionSchema/SchemaTableCell.tsx | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index d3259d42e..bcb94e10d 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -73,11 +73,8 @@ export class CollectionSchemaView extends CollectionSubView() { constructor(props: any) { super(props); makeObservable(this); - const lightenedColor = (r: number, g: number, b:number) => { - const lightened = ClientUtils.lightenRGB(r, g, b, 165); - return {r: lightened[0], g: lightened[1], b: lightened[2]} - } - const colors = (r: number, g: number, b: number): [any, any] => {return [{r: r, g: g, b: b}, lightenedColor(r, g, b)]} + const lightenedColor = (r: number, g: number, b:number) => { const lightened = ClientUtils.lightenRGB(r, g, b, 165); return {r: lightened[0], g: lightened[1], b: lightened[2]}} // prettier-ignore + const colors = (r: number, g: number, b: number): [any, any] => {return [{r: r, g: g, b: b}, lightenedColor(r, g, b)]} // prettier-ignore this._eqHighlightColors.push(colors(70, 150, 50)); this._eqHighlightColors.push(colors(180, 70, 20)); this._eqHighlightColors.push(colors(70, 50, 150)); @@ -602,7 +599,11 @@ export class CollectionSchemaView extends CollectionSubView() { } removeCellHighlights = () => { - this.highlightedCells.forEach(cell => {cell.style.border = ''; cell.style.backgroundColor = '';}); + this._highlightedCellsInfo.forEach(info => { + const doc = info[0]; + const cell = this.getCellElement(doc, info[1]); + if (!this._selectedDocs.includes(doc)) cell.style.border = ''; + cell.style.backgroundColor = '';}); this._highlightedCellsInfo = []; } diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 084306c4a..1f5684151 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -266,6 +266,8 @@ export class SchemaTableCell extends ObservableReactComponent StopEvent(e)} onPointerDown={action(e => { + if (this.lockedInteraction) { e.stopPropagation(); e.preventDefault(); return; } + if (this._props.refSelectModeInfo.enabled && !selectedCell(this._props)){ e.stopPropagation(); e.preventDefault(); -- cgit v1.2.3-70-g09d2