Skip to content

Commit

Permalink
experiment scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
BryonLewis committed Feb 24, 2024
1 parent c58455d commit dfd42de
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
15 changes: 13 additions & 2 deletions client/package-lock.json

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

2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"d3": "^7.8.5",
"django-s3-file-field": "^1.0.0",
"geojs": "^1.11.1",
"gl-matrix": "^3.4.3",
"lodash": "^4.17.21",
"vue": "^3.3.1",
"vue-markdown-render": "^2.1.1",
Expand All @@ -29,6 +30,7 @@
},
"devDependencies": {
"@types/geojson": "^7946.0.13",
"@types/gl-matrix": "^3.2.0",
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.202",
"@types/markdown-it": "^13.0.7",
Expand Down
30 changes: 30 additions & 0 deletions client/src/components/SpectrogramViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import LayerManager from "./geoJS/LayerManager.vue";
import { GeoEvent } from "geojs";
import geo from "geojs";
import useState from "../use/useState";
import * as glMatrix from 'gl-matrix';

Check warning on line 16 in client/src/components/SpectrogramViewer.vue

View workflow job for this annotation

GitHub Actions / Lint [eslint]

'glMatrix' is defined but never used
export default defineComponent({
name: "SpectroViewer",
Expand Down Expand Up @@ -182,6 +183,33 @@ export default defineComponent({
}
);
const wheelEvent = (event: WheelEvent) => {
const geoViewerRef = geoJS.getGeoViewer();
if (geoViewerRef.value) {
const camera = geoViewerRef.value.camera();
const view = camera.view;
console.log(view);

Check failure on line 193 in client/src/components/SpectrogramViewer.vue

View workflow job for this annotation

GitHub Actions / Lint [eslint]

Unexpected console statement
let baseZoomX = view[0];
let baseZoomY = view[5];
// view[5] = view[5] * 1.1
if (event.ctrlKey) {
// Zoom along the X-axis
baseZoomX += event.deltaY * 0.000001;
} else if (event.shiftKey) {
// Zoom along the Y-axis
baseZoomY += event.deltaY * 0.000001;
}
view[0] = baseZoomX;
view[5] = baseZoomY;
camera.view = view;
geoViewerRef.value.draw();
}
};
return {
containerRef,
Expand All @@ -194,6 +222,7 @@ export default defineComponent({
cursorHandler,
imageCursorRef,
blackBackground,
wheelEvent,
};
},
});
Expand All @@ -203,6 +232,7 @@ export default defineComponent({
<div
class="video-annotator"
:class="{'black-background': blackBackground, 'white-background': !blackBackground}"
@wheel="wheelEvent($event)"
>
<div
id="spectro"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/geoJS/geoJSUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useGeoJS = () => {
interactorOpts.keyboard.focusHighlight = false;
interactorOpts.keyboard.actions = {};
interactorOpts.click.cancelOnMove = 5;

console.log(interactorOpts);

Check failure on line 42 in client/src/components/geoJS/geoJSUtils.ts

View workflow job for this annotation

GitHub Actions / Lint [eslint]

Unexpected console statement
interactorOpts.actions = [
interactorOpts.actions[0],
// The action below is needed to have GeoJS use the proper handler
Expand Down

0 comments on commit dfd42de

Please sign in to comment.