Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(viewer.js): Trigger ROI selection event even when no select interaction is active #117

Merged
merged 13 commits into from
May 9, 2024
Merged
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ Note that the *dicom-microscopy-viewer* package is **not** a viewer application,
Below is an example for the most basic usage: a web page that displays a collection of DICOM VL Whole Slide Microscopy Image instances of a digital slide.
For more advanced usage, take a look at the [Slim](https://github.com/imagingdatacommons/slim) viewer.

## Packaging

The library is packaged as two different builds, one using dynamic import, and the other bundling into one
larger library. The dynamic import version uses a public path of `/dicom-microscopy-viewer/` so that they can be used by simply adding an alias to the appropriate version, and then deploying that version. In a straight web application, this can be loaded as:

```javascript
const DICOMMicroscopyViewer = (await('/dicom-microscopy-viewer/dicomMicroscopyViewer.min.js')).default
```

The point of using the sub-directory here is to isolate the dependencies that unique to `dicom-microscopy-viewer`.

### Basic usage

The viewer can be embedded in any website, one only needs to
Expand Down
12 changes: 4 additions & 8 deletions config/webpack/webpack-dynamic-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const merge = require('./merge')
const rootPath = process.cwd()
const baseConfig = require('./webpack-base')
const TerserPlugin = require('terser-webpack-plugin')
const outputPath = path.join(rootPath, 'dist', 'dynamic-import', 'dicom-microscopy-viewer')
const outputPath = path.join(rootPath, 'dist', 'dynamic-import')

const prodConfig = {
mode: 'production',
Expand All @@ -12,15 +12,11 @@ const prodConfig = {
},
output: {
path: outputPath,
library: {
name: 'dicomMicroscopyViewer',
type: 'window',
},
filename: '[name].min.js',
publicPath: '/dicom-microscopy-viewer/',
libraryTarget: 'umd',
globalObject: 'this',
filename: '[name].min.js'
},
optimization: {
// minimize: false,
minimizer: [
new TerserPlugin({
parallel: true
Expand Down
125 changes: 58 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.16",
"@babel/runtime-corejs3": "^7.15.4",
"@webpack-cli/serve": "^1.5.2",
"babel-eslint": "10.1.0",
"babel-jest": "27.5",
"babel-loader": "^8.2.3",
Expand All @@ -71,7 +72,7 @@
"terser-webpack-plugin": "^5.2.2",
"webpack": "^5.68",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^5.1.4",
"webpack-cli": "^4.9",
igoroctaviano marked this conversation as resolved.
Show resolved Hide resolved
"webpack-dev-server": "^4.9.0",
"worker-loader": "^3.0.8"
},
Expand Down
2 changes: 2 additions & 0 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const EVENTS = {
ROI_DRAWN: `${PROJECT_NAME}_roi_drawn`,
/** Triggered when a ROI was selected. */
ROI_SELECTED: `${PROJECT_NAME}_roi_selected`,
/** Triggered when a ROI was double clicked. */
ROI_DOUBLE_CLICKED: `${PROJECT_NAME}_roi_double_clicked`,
/** Triggered when a ROI was modified. */
ROI_MODIFIED: `${PROJECT_NAME}_roi_modified`,
/** Triggered when a viewport move has started. */
Expand Down
Loading
Loading