aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-30 18:45:55 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-30 18:45:55 -0500
commit76b99cf70c36ca8a691010c86f5f444dd30eb004 (patch)
tree396d7328d46d66dc83afc7f2941d410538243bf5 /src/client/views/search
parent17dcf7e4d8c2f038dc3a6168b1ff6b8d3cb15536 (diff)
parentd7a076ca7315a892b6a43b0e7454abf470f48455 (diff)
some bugfixes
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/SearchBox.scss1
-rw-r--r--src/client/views/search/SearchBox.tsx19
-rw-r--r--src/client/views/search/SearchItem.tsx12
3 files changed, 16 insertions, 16 deletions
diff --git a/src/client/views/search/SearchBox.scss b/src/client/views/search/SearchBox.scss
index 0825580b7..f492ea773 100644
--- a/src/client/views/search/SearchBox.scss
+++ b/src/client/views/search/SearchBox.scss
@@ -9,6 +9,7 @@
position: absolute;
font-size: 10px;
line-height: 1;
+ overflow: hidden;
}
.searchBox-bar {
height: 32px;
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index dd1ac7421..be13dae03 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -217,16 +217,16 @@ export class SearchBox extends React.Component {
doc.x = x;
doc.y = y;
const size = 200;
- const aspect = NumCast(doc.nativeHeight) / NumCast(doc.nativeWidth, 1);
+ const aspect = NumCast(doc._nativeHeight) / NumCast(doc._nativeWidth, 1);
if (aspect > 1) {
- doc.height = size;
- doc.width = size / aspect;
+ doc._height = size;
+ doc._width = size / aspect;
} else if (aspect > 0) {
- doc.width = size;
- doc.height = size * aspect;
+ doc._width = size;
+ doc._height = size * aspect;
} else {
- doc.width = size;
- doc.height = size;
+ doc._width = size;
+ doc._height = size;
}
x += 250;
if (x > 1000) {
@@ -234,7 +234,7 @@ export class SearchBox extends React.Component {
y += 300;
}
}
- return Docs.Create.TreeDocument(docs, { width: 200, height: 400, backgroundColor: "grey", title: `Search Docs: "${this._searchString}"` });
+ return Docs.Create.TreeDocument(docs, { _width: 200, _height: 400, backgroundColor: "grey", title: `Search Docs: "${this._searchString}"` });
}
@action.bound
@@ -267,10 +267,11 @@ export class SearchBox extends React.Component {
@action
resultsScrolled = (e?: React.UIEvent<HTMLDivElement>) => {
+ if (!this.resultsRef.current) return;
const scrollY = e ? e.currentTarget.scrollTop : this.resultsRef.current ? this.resultsRef.current.scrollTop : 0;
const itemHght = 53;
const startIndex = Math.floor(Math.max(0, scrollY / itemHght));
- const endIndex = Math.ceil(Math.min(this._numTotalResults - 1, startIndex + (this.resultsRef.current!.getBoundingClientRect().height / itemHght)));
+ const endIndex = Math.ceil(Math.min(this._numTotalResults - 1, startIndex + (this.resultsRef.current.getBoundingClientRect().height / itemHght)));
this._endIndex = endIndex === -1 ? 12 : endIndex;
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 88a4d4c50..8aea737f0 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -68,11 +68,11 @@ export class SelectorContextMenu extends React.Component<SearchItemProps> {
getOnClick({ col, target }: { col: Doc, target: Doc }) {
return () => {
col = Doc.IsPrototype(col) ? Doc.MakeDelegate(col) : col;
- if (NumCast(col.viewType, CollectionViewType.Invalid) === CollectionViewType.Freeform) {
- const newPanX = NumCast(target.x) + NumCast(target.width) / 2;
- const newPanY = NumCast(target.y) + NumCast(target.height) / 2;
- col.panX = newPanX;
- col.panY = newPanY;
+ if (NumCast(col._viewType, CollectionViewType.Invalid) === CollectionViewType.Freeform) {
+ const newPanX = NumCast(target.x) + NumCast(target._width) / 2;
+ const newPanY = NumCast(target.y) + NumCast(target._height) / 2;
+ col._panX = newPanX;
+ col._panY = newPanY;
}
CollectionDockingView.AddRightSplit(col, undefined);
};
@@ -161,7 +161,6 @@ export class SearchItem extends React.Component<SearchItemProps> {
fitToBox={StrCast(this.props.doc.type).indexOf(DocumentType.COL) !== -1}
addDocument={returnFalse}
removeDocument={returnFalse}
- ruleProvider={undefined}
addDocTab={returnFalse}
pinToPres={returnFalse}
getTransform={Transform.Identity}
@@ -260,7 +259,6 @@ export class SearchItem extends React.Component<SearchItemProps> {
onPointerMoved = (e: PointerEvent) => {
if (Math.abs(e.clientX - this._downX) > Utils.DRAG_THRESHOLD ||
Math.abs(e.clientY - this._downY) > Utils.DRAG_THRESHOLD) {
- console.log("DRAGGIGNG");
document.removeEventListener("pointermove", this.onPointerMoved);
document.removeEventListener("pointerup", this.onPointerUp);
const doc = Doc.IsPrototype(this.props.doc) ? Doc.MakeDelegate(this.props.doc) : this.props.doc;