aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-05-22 20:10:00 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-05-22 20:10:00 -0400
commitc65d4f5f14c5a0fac9c06a7c4e0771b342a57b74 (patch)
treee2184d9064968b9548ac738866e081385311d880
parent30fdae9e869e0f132c76b4fa99b784e75d6c8dae (diff)
Made search collection slightly better
-rw-r--r--src/client/views/SearchBox.tsx20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx
index fa9462acf..63d2065e2 100644
--- a/src/client/views/SearchBox.tsx
+++ b/src/client/views/SearchBox.tsx
@@ -144,18 +144,26 @@ export class SearchBox extends React.Component {
});
let x = 0;
let y = 0;
- let maxy = 300;
for (const doc of docs) {
doc.x = x;
doc.y = y;
- doc.width = 200;
- doc.height = 200 * NumCast(doc.nativeHeight) / NumCast(doc.nativeWidth, 1);
- maxy = Math.max(doc.height, maxy);
+ const size = 200;
+ const aspect = NumCast(doc.nativeHeight) / NumCast(doc.nativeWidth, 1);
+ if (aspect > 1) {
+ doc.height = size;
+ doc.width = size / aspect;
+ } else if (aspect > 0) {
+ doc.width = size;
+ doc.height = size * aspect;
+ } else {
+ doc.width = size;
+ doc.height = size;
+ }
+ doc.zoomBasis = 1;
x += 250;
if (x > 1000) {
- maxy = 300;
x = 0;
- y += maxy + 25;
+ y += 300;
}
}
return Docs.FreeformDocument(docs, { width: 400, height: 400, panX: 175, panY: 175, backgroundColor: "grey", title: `Search Docs: "${this.searchString}"` });