Skip to content
Snippets Groups Projects
Verified Commit 2de71320 authored by Loïs Poujade's avatar Loïs Poujade
Browse files

Expose VideoViewerReferences like OSDReferences

OSDReferences is a list of ref to OpenSeadragon instances, used in
Mirador as an image viewer. This commit exposes a VideoViewerReferences,
to allows the annotations plugins to get video canvas dimensions and DOM
element

+ removed build warning
+ disable "prepare" script to speed up build
parent 5711fee5
Branches
Tags
4 merge requests!4Integrate upstream tests into gitlab ci,!3Update mirador code from official project,!2test gitlab ci (dont merge),!1Expose VideoViewerReferences like OSDReferences
...@@ -47,44 +47,20 @@ module.exports = function (api) { ...@@ -47,44 +47,20 @@ module.exports = function (api) {
const plugins = [ const plugins = [
'babel-plugin-macros', 'babel-plugin-macros',
'@babel/plugin-transform-destructuring', '@babel/plugin-transform-destructuring',
[ // TODO loose: which options is ignored in depencies ?
'@babel/plugin-proposal-class-properties', ['@babel/plugin-proposal-private-methods', { loose: true }],
{ ['@babel/plugin-proposal-private-property-in-object', { loose: true }],
loose: true, ['@babel/plugin-proposal-class-properties', { loose: true }],
}, ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }],
], ['@babel/plugin-transform-runtime', {
[
'@babel/plugin-proposal-object-rest-spread',
{
useBuiltIns: true,
},
],
[
'@babel/plugin-transform-runtime',
{
corejs: false, corejs: false,
helpers: false, // Needed to support IE/Edge helpers: false, // Needed to support IE/Edge
regenerator: true, regenerator: true,
}, },
], ],
[ ['@babel/plugin-transform-regenerator', { async: false }],
'@babel/plugin-transform-regenerator', ['transform-react-remove-prop-types', { ignoreFilenames: ['node_modules'], removeImport: true }],
{ ['lodash', { id: ['lodash'] }],
async: false,
},
],
['transform-react-remove-prop-types',
{
ignoreFilenames: ['node_modules'],
removeImport: true,
},
],
['lodash', {
id: [
'lodash',
],
},
],
].filter(Boolean); ].filter(Boolean);
return { return {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"prepare": "npm run clean && npm run build:es && npm run build:cjs",
"clean": "rm -rf ./dist", "clean": "rm -rf ./dist",
"lint": "node_modules/.bin/eslint ./ && npm run lint:translations && npm run lint:containers", "lint": "node_modules/.bin/eslint ./ && npm run lint:translations && npm run lint:containers",
"lint:containers": "node ./scripts/container-lint.js", "lint:containers": "node ./scripts/container-lint.js",
......
...@@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; ...@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import AnnotationItem from '../lib/AnnotationItem'; import AnnotationItem from '../lib/AnnotationItem';
import AnnotationsOverlayVideo from '../containers/AnnotationsOverlayVideo'; import AnnotationsOverlayVideo from '../containers/AnnotationsOverlayVideo';
import WindowCanvasNavigationControlsVideo from '../containers/WindowCanvasNavigationControlsVideo'; import WindowCanvasNavigationControlsVideo from '../containers/WindowCanvasNavigationControlsVideo';
import { VideoViewersReferences } from '../plugins/VideoViewersReferences';
/** */ /** */
export class VideoViewer extends Component { export class VideoViewer extends Component {
...@@ -12,6 +13,8 @@ export class VideoViewer extends Component { ...@@ -12,6 +13,8 @@ export class VideoViewer extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.videoRef = React.createRef(); this.videoRef = React.createRef();
this.apiRef = React.createRef();
VideoViewersReferences.set(props.windowId, this);
this.state = { this.state = {
start: 0, start: 0,
...@@ -156,7 +159,7 @@ export class VideoViewer extends Component { ...@@ -156,7 +159,7 @@ export class VideoViewer extends Component {
}; };
} }
return ( return (
<div className={classes.flexContainer}> <div className={classes.flexContainer} ref={this.apiRef}>
<div className={classes.flexFill}> <div className={classes.flexFill}>
{ video && ( { video && (
<> <>
......
...@@ -138,6 +138,7 @@ export default class AnnotationItem { ...@@ -138,6 +138,7 @@ export default class AnnotationItem {
break; break;
case 'object': case 'object':
temporalfragmentSelector = selector.find(s => s.type && s.type === 'FragmentSelector'); temporalfragmentSelector = selector.find(s => s.type && s.type === 'FragmentSelector');
// TODO regex for t=5,10 t=,10 t=5 ? cf w3c media fragments
match = temporalfragmentSelector && temporalfragmentSelector.value.match(/t=(.*?)(&|$)/); match = temporalfragmentSelector && temporalfragmentSelector.value.match(/t=(.*?)(&|$)/);
break; break;
default: default:
......
export const VideoViewersReferences = {
/** */
get(windowId) {
return this.refs[windowId];
},
refs: {},
/** */
set(windowId, ref) {
this.refs[windowId] = ref;
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment