Skip to content

Commit

Permalink
chore: install scalebar plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloster committed Oct 1, 2024
1 parent c2552bf commit 8eee3fa
Show file tree
Hide file tree
Showing 6 changed files with 654 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .infra/rdev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ stack:
services:
explorer:
image:
tag: sha-a694292f
tag: sha-d7cb0a9b
replicaCount: 1
env:
# env vars common to all deployment stages
Expand Down
1 change: 1 addition & 0 deletions client/configuration/eslint/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../src/components/Graph/openseadragon-scalebar.js
20 changes: 20 additions & 0 deletions client/configuration/eslint/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["src/components/Graph/openseadragon-scalebar.js"],
rules: {
"func-names": "off",
"@typescript-eslint/no-redeclare": "off",
"global-require": "off",
"no-var": "off",
"vars-on-top": "off",
"block-scoped-var": "off",
"@typescript-eslint/no-this-alias": "off",
"consistent-return": "off",
"no-restricted-properties": [
"off",
{
object: "Math",
property: "pow",
},
],
},
},
],
};
/* eslint-enable @blueprintjs/classes-constants -- we don't import blueprint here */
12 changes: 12 additions & 0 deletions client/src/components/Graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import memoize from "memoize-one";
import Async, { AsyncProps } from "react-async";
import { Button, Icon } from "@blueprintjs/core";
import Openseadragon, { Viewer } from "openseadragon";
import "./openseadragon-scalebar";
import { throttle } from "lodash";
import { IconNames } from "@blueprintjs/icons";
import _camera, { Camera } from "util/camera";
Expand Down Expand Up @@ -1187,6 +1188,17 @@ class Graph extends React.Component<GraphProps, GraphState> {
opacity: imageOpacity / 100,
});

this.openseadragon.scalebar({
type: Openseadragon.ScalebarType.MICROSCOPY,
pixelsPerMeter: 1000000, // this needs to be adjusted based on the image
minWidth: "75px",
location: Openseadragon.ScalebarLocation.BOTTOM_LEFT,
color: "white",
fontColor: "black",
backgroundColor: "rgba(255, 255, 255, 0.5)",
barThickness: 3,
});

/**
* (thuang): Remove the openseadragon element when the image fails to load,
* likely because the image is not found in the S3 bucket.
Expand Down
Loading

0 comments on commit 8eee3fa

Please sign in to comment.