@cu-mkp/editioncrafter 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editioncrafter.min.js +1 -1
- package/dist/es/src/action/DocumentActions.js +11 -0
- package/dist/es/src/action/initialState/documentInitialState.js +6 -0
- package/dist/es/src/action/rootReducer.js +21 -4
- package/dist/es/src/component/DiploMatic.js +38 -7
- package/dist/es/src/component/DocumentView.js +101 -32
- package/dist/es/src/component/ImageGridView.js +96 -20
- package/dist/es/src/component/ImageView.js +30 -5
- package/dist/es/src/component/Navigation.js +109 -11
- package/dist/es/src/component/RingSpinner.js +40 -0
- package/dist/es/src/component/SeaDragonComponent.js +40 -6
- package/dist/es/src/component/SinglePaneView.js +8 -8
- package/dist/es/src/component/SplitPaneView.js +53 -25
- package/dist/es/src/component/TranscriptionView.js +38 -11
- package/dist/es/src/component/Watermark.js +1 -1
- package/dist/es/src/component/XMLView.js +2 -1
- package/dist/es/src/img/editioncrafterlogo.png +0 -0
- package/dist/es/src/index.js +2 -2
- package/dist/es/src/model/ReduxStore.js +1 -0
- package/dist/es/src/saga/RouteListenerSaga.js +82 -33
- package/dist/es/src/scss/_CETEIcean.scss +1 -1
- package/dist/es/src/scss/_diplomatic.scss +12 -9
- package/dist/es/src/scss/_glossary.scss +5 -0
- package/dist/es/src/scss/_imageGridView.scss +10 -0
- package/dist/es/src/scss/_imageView.scss +2 -1
- package/dist/es/src/scss/_navigation.scss +57 -6
- package/dist/es/src/scss/_ringSpinner.scss +88 -0
- package/dist/es/src/scss/_splitPaneView.scss +15 -1
- package/dist/es/src/scss/_watermark.scss +5 -1
- package/dist/es/src/scss/editioncrafter.scss +8 -6
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import Navigation from './Navigation';
|
|
|
17
17
|
import ImageZoomControl from './ImageZoomControl';
|
|
18
18
|
import SeaDragonComponent from './SeaDragonComponent';
|
|
19
19
|
import '@recogito/annotorious-openseadragon/dist/annotorious.min.css';
|
|
20
|
+
import { BigRingSpinner } from './RingSpinner';
|
|
20
21
|
var ImageView = function ImageView(props) {
|
|
21
22
|
var _ref;
|
|
22
23
|
var _useState = useState(null),
|
|
@@ -27,11 +28,22 @@ var ImageView = function ImageView(props) {
|
|
|
27
28
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
29
|
anno = _useState4[0],
|
|
29
30
|
setAnno = _useState4[1];
|
|
31
|
+
|
|
32
|
+
// const [onZoomFixed_1, setOnZoomFixed_1] = useState(() => null);
|
|
33
|
+
// const [onZoomFixed_2, setOnZoomFixed_2] = useState(() => null);
|
|
34
|
+
// const [onZoomFixed_3, setOnZoomFixed_3] = useState(() => null);
|
|
35
|
+
// const [onZoomOut, setOnZoomOut] = useState(() => null);
|
|
36
|
+
// const [onZoomIn, setOnZoomIn] = useState(() => null);
|
|
37
|
+
|
|
30
38
|
var location = useLocation();
|
|
31
39
|
var navigate = useNavigate();
|
|
32
40
|
var _useSearchParams = useSearchParams(),
|
|
33
41
|
_useSearchParams2 = _slicedToArray(_useSearchParams, 1),
|
|
34
42
|
searchParams = _useSearchParams2[0];
|
|
43
|
+
var _useState5 = useState(false),
|
|
44
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
+
loading = _useState6[0],
|
|
46
|
+
setLoading = _useState6[1];
|
|
35
47
|
useEffect(function () {
|
|
36
48
|
if (anno && searchParams.get('zone')) {
|
|
37
49
|
// TODO: Figure out why annotations are an empty list
|
|
@@ -54,6 +66,7 @@ var ImageView = function ImageView(props) {
|
|
|
54
66
|
viewer.viewport.fitVertically();
|
|
55
67
|
};
|
|
56
68
|
var onZoomIn = function onZoomIn(e) {
|
|
69
|
+
console.log(viewer.viewport.fitVertically());
|
|
57
70
|
viewer.viewport.zoomBy(2);
|
|
58
71
|
};
|
|
59
72
|
var onZoomOut = function onZoomOut(e) {
|
|
@@ -129,19 +142,26 @@ var ImageView = function ImageView(props) {
|
|
|
129
142
|
var tileSource = props.document.folioIndex[props.folioID].tileSource;
|
|
130
143
|
useEffect(function () {
|
|
131
144
|
var folio = props.document.folioIndex[props.folioID];
|
|
145
|
+
if (folio.loading) {
|
|
146
|
+
setLoading(true);
|
|
147
|
+
}
|
|
132
148
|
if (folio.tileSource && viewer) {
|
|
133
149
|
viewer.open(folio.tileSource);
|
|
134
150
|
if (folio.annotations && anno) {
|
|
135
151
|
anno.setAnnotations(folio.annotations);
|
|
136
152
|
}
|
|
137
153
|
}
|
|
154
|
+
if (!folio.loading) {
|
|
155
|
+
setLoading(false);
|
|
156
|
+
}
|
|
138
157
|
}, [anno, viewer, props.folioID, props.document.folioIndex]);
|
|
139
|
-
return /*#__PURE__*/React.createElement("div", null, tileSource
|
|
158
|
+
return /*#__PURE__*/React.createElement("div", null, tileSource ? /*#__PURE__*/React.createElement("div", {
|
|
140
159
|
className: "image-view imageViewComponent ".concat(props.side)
|
|
141
160
|
}, /*#__PURE__*/React.createElement(Navigation, {
|
|
142
161
|
side: props.side,
|
|
143
162
|
documentView: props.documentView,
|
|
144
|
-
documentViewActions: props.documentViewActions
|
|
163
|
+
documentViewActions: props.documentViewActions,
|
|
164
|
+
documentName: props.document.variorum && props.document.folioIndex[props.folioID].doc_id
|
|
145
165
|
}), /*#__PURE__*/React.createElement(ImageZoomControl, {
|
|
146
166
|
side: props.side,
|
|
147
167
|
documentView: props.documentView,
|
|
@@ -150,13 +170,18 @@ var ImageView = function ImageView(props) {
|
|
|
150
170
|
onZoomFixed_3: onZoomFixed_3,
|
|
151
171
|
onZoomGrid: onZoomGrid,
|
|
152
172
|
onZoomIn: onZoomIn,
|
|
153
|
-
onZoomOut: onZoomOut
|
|
173
|
+
onZoomOut: onZoomOut,
|
|
174
|
+
viewer: viewer
|
|
154
175
|
}), /*#__PURE__*/React.createElement(SeaDragonComponent, {
|
|
155
176
|
key: props.folioID,
|
|
156
177
|
side: props.side,
|
|
157
178
|
tileSource: tileSource,
|
|
158
|
-
initViewer: initViewer
|
|
159
|
-
|
|
179
|
+
initViewer: initViewer,
|
|
180
|
+
loading: loading
|
|
181
|
+
})) : /*#__PURE__*/React.createElement(BigRingSpinner, {
|
|
182
|
+
color: "dark",
|
|
183
|
+
delay: 300
|
|
184
|
+
}));
|
|
160
185
|
};
|
|
161
186
|
function mapStateToProps(state) {
|
|
162
187
|
return {
|
|
@@ -9,7 +9,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
10
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
import React, { useState, useRef } from 'react';
|
|
12
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
13
13
|
import { connect } from 'react-redux';
|
|
14
14
|
import { FaArrowCircleLeft, FaArrowCircleRight } from 'react-icons/fa';
|
|
15
15
|
import Select from '@material-ui/core/Select';
|
|
@@ -34,7 +34,15 @@ var Navigation = function Navigation(props) {
|
|
|
34
34
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
35
|
openHelp = _useState4[0],
|
|
36
36
|
setOpenHelp = _useState4[1];
|
|
37
|
+
var _useState5 = useState(false),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
openHelpNarrow = _useState6[0],
|
|
40
|
+
setOpenHelpNarrow = _useState6[1];
|
|
37
41
|
var helpRef = useRef(null);
|
|
42
|
+
var helpRefNarrow = useRef(null);
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
console.log(helpRef.current);
|
|
45
|
+
}, []);
|
|
38
46
|
var onJumpBoxBlur = function onJumpBoxBlur(event) {
|
|
39
47
|
setPopover(_objectSpread(_objectSpread({}, popover), {}, {
|
|
40
48
|
show: false
|
|
@@ -44,9 +52,15 @@ var Navigation = function Navigation(props) {
|
|
|
44
52
|
if (event.target.value === undefined) return;
|
|
45
53
|
props.documentViewActions.changeTranscriptionType(props.side, event.target.value);
|
|
46
54
|
};
|
|
55
|
+
var onGoToGrid = function onGoToGrid(event) {
|
|
56
|
+
props.documentViewActions.changeTranscriptionType(props.side, 'g');
|
|
57
|
+
};
|
|
47
58
|
var toggleHelp = function toggleHelp(event) {
|
|
48
59
|
setOpenHelp(!openHelp);
|
|
49
60
|
};
|
|
61
|
+
var toggleHelpNarrow = function toggleHelpNarrow(event) {
|
|
62
|
+
setOpenHelpNarrow(!openHelpNarrow);
|
|
63
|
+
};
|
|
50
64
|
var toggleBookmode = function toggleBookmode(event) {
|
|
51
65
|
if (!props.documentView.bookMode) {
|
|
52
66
|
props.documentViewActions.changeCurrentFolio(props.documentView.left.iiifShortID, 'left', props.documentView.left.transcriptionType);
|
|
@@ -103,7 +117,7 @@ var Navigation = function Navigation(props) {
|
|
|
103
117
|
}
|
|
104
118
|
var getSelectContainerStyle = function getSelectContainerStyle() {
|
|
105
119
|
if (isWidthUp) {
|
|
106
|
-
if (documentView[side].width < 500) {
|
|
120
|
+
if (documentView[side].width < 500 && !document.variorum) {
|
|
107
121
|
return {
|
|
108
122
|
display: 'none'
|
|
109
123
|
};
|
|
@@ -130,7 +144,9 @@ var Navigation = function Navigation(props) {
|
|
|
130
144
|
} : {
|
|
131
145
|
visibility: 'visible'
|
|
132
146
|
};
|
|
133
|
-
var selectContainerStyle =
|
|
147
|
+
var selectContainerStyle = {
|
|
148
|
+
display: 'flex'
|
|
149
|
+
}; //what's the reason we want this to be hidden sometimes?
|
|
134
150
|
var lockIconClass = documentView.linkedMode ? 'fa fa-lock' : 'fa fa-lock-open';
|
|
135
151
|
if (!documentView.bookMode) {
|
|
136
152
|
lockIconClass += ' active';
|
|
@@ -150,7 +166,7 @@ var Navigation = function Navigation(props) {
|
|
|
150
166
|
} : {
|
|
151
167
|
marginRight: '15px'
|
|
152
168
|
};
|
|
153
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
154
170
|
className: "navigationComponent",
|
|
155
171
|
style: widthStyle
|
|
156
172
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -161,6 +177,14 @@ var Navigation = function Navigation(props) {
|
|
|
161
177
|
className: "breadcrumbs",
|
|
162
178
|
style: showButtonsStyle
|
|
163
179
|
}, /*#__PURE__*/React.createElement("span", {
|
|
180
|
+
className: "fas fa-th",
|
|
181
|
+
style: {
|
|
182
|
+
cursor: documentView[side].transcriptionType !== 'g' ? 'pointer' : 'default',
|
|
183
|
+
padding: '0 15px'
|
|
184
|
+
},
|
|
185
|
+
title: documentView[side].transcriptionType !== 'g' && "Return to Grid View",
|
|
186
|
+
onClick: documentView[side].transcriptionType !== 'g' && onGoToGrid
|
|
187
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
164
188
|
title: "Toggle coordination of views",
|
|
165
189
|
onClick: toggleLockmode,
|
|
166
190
|
className: lockIconClass
|
|
@@ -182,7 +206,7 @@ var Navigation = function Navigation(props) {
|
|
|
182
206
|
onClick: changeCurrentFolio,
|
|
183
207
|
"data-id": documentView[side].nextFolioShortID,
|
|
184
208
|
className: documentView[side].hasNext ? 'arrow' : 'arrow disabled'
|
|
185
|
-
}, ' ', /*#__PURE__*/React.createElement(FaArrowCircleRight, null)), "\xA0\xA0", document.documentName, ' / ', /*#__PURE__*/React.createElement("div", {
|
|
209
|
+
}, ' ', /*#__PURE__*/React.createElement(FaArrowCircleRight, null)), "\xA0\xA0", props.documentName || document.documentName, ' / ', /*#__PURE__*/React.createElement("div", {
|
|
186
210
|
onClick: revealJumpBox,
|
|
187
211
|
className: "folioName"
|
|
188
212
|
}, ' ', folioName, ' ', /*#__PURE__*/React.createElement("span", {
|
|
@@ -201,9 +225,7 @@ var Navigation = function Navigation(props) {
|
|
|
201
225
|
}), /*#__PURE__*/React.createElement("div", {
|
|
202
226
|
id: "doc-type-help",
|
|
203
227
|
style: selectContainerStyle,
|
|
204
|
-
ref:
|
|
205
|
-
helpRef.current = e;
|
|
206
|
-
}
|
|
228
|
+
ref: helpRef
|
|
207
229
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
208
230
|
className: selectClass,
|
|
209
231
|
style: _objectSpread(_objectSpread({}, selectColorStyle), {}, {
|
|
@@ -212,11 +234,15 @@ var Navigation = function Navigation(props) {
|
|
|
212
234
|
value: documentView[side].transcriptionType,
|
|
213
235
|
id: "doc-type",
|
|
214
236
|
onClick: changeType
|
|
215
|
-
}, Object.keys(props.document.
|
|
237
|
+
}, Object.keys(props.document.folios.find(function (fol) {
|
|
238
|
+
return fol.id == props.documentView[props.side].iiifShortID;
|
|
239
|
+
}).annotationURLs).map(function (ttKey) {
|
|
216
240
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
217
241
|
value: ttKey,
|
|
218
242
|
key: ttKey
|
|
219
|
-
}, props.document.transcriptionTypes[
|
|
243
|
+
}, props.document.variorum ? props.document.transcriptionTypes[props.document.folios.find(function (fol) {
|
|
244
|
+
return fol.id == props.documentView[props.side].iiifShortID;
|
|
245
|
+
}).doc_id][ttKey] : props.document.transcriptionTypes[ttKey]);
|
|
220
246
|
}), /*#__PURE__*/React.createElement(MenuItem, {
|
|
221
247
|
value: "f",
|
|
222
248
|
key: "f"
|
|
@@ -234,7 +260,79 @@ var Navigation = function Navigation(props) {
|
|
|
234
260
|
anchorEl: helpRef.current,
|
|
235
261
|
open: openHelp,
|
|
236
262
|
onClose: toggleHelp
|
|
237
|
-
}))))
|
|
263
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
264
|
+
className: "navigationComponentNarrow"
|
|
265
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
266
|
+
id: "navigation-row",
|
|
267
|
+
className: "navigationRowNarrow"
|
|
268
|
+
}, documentView[side].transcriptionType !== 'glossary' ? /*#__PURE__*/React.createElement("div", {
|
|
269
|
+
id: "tool-bar-buttons",
|
|
270
|
+
className: "breadcrumbsNarrow",
|
|
271
|
+
style: showButtonsStyle
|
|
272
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
273
|
+
className: "fas fa-th",
|
|
274
|
+
style: {
|
|
275
|
+
cursor: documentView[side].transcriptionType !== 'g' ? 'pointer' : 'default',
|
|
276
|
+
padding: '0 15px'
|
|
277
|
+
},
|
|
278
|
+
title: documentView[side].transcriptionType !== 'g' && "Return to Grid View",
|
|
279
|
+
onClick: documentView[side].transcriptionType !== 'g' && onGoToGrid
|
|
280
|
+
}), "\xA0", /*#__PURE__*/React.createElement("span", {
|
|
281
|
+
title: "Toggle XML mode",
|
|
282
|
+
onClick: toggleXMLMode,
|
|
283
|
+
className: imageViewActive ? 'invisible' : xmlIconClass
|
|
284
|
+
}), imageViewActive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
285
|
+
title: "Go back",
|
|
286
|
+
onClick: changeCurrentFolio,
|
|
287
|
+
"data-id": documentView[side].previousFolioShortID,
|
|
288
|
+
className: documentView[side].hasPrevious ? 'arrow' : 'arrow disabled'
|
|
289
|
+
}, ' ', /*#__PURE__*/React.createElement(FaArrowCircleLeft, null), ' '), /*#__PURE__*/React.createElement("span", {
|
|
290
|
+
title: "Go forward",
|
|
291
|
+
onClick: changeCurrentFolio,
|
|
292
|
+
"data-id": documentView[side].nextFolioShortID,
|
|
293
|
+
className: documentView[side].hasNext ? 'arrow' : 'arrow disabled'
|
|
294
|
+
}, ' ', /*#__PURE__*/React.createElement(FaArrowCircleRight, null)))) : /*#__PURE__*/React.createElement(AlphabetLinks, {
|
|
295
|
+
onFilterChange: onFilterChange,
|
|
296
|
+
value: props.value
|
|
297
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
id: "doc-type-help",
|
|
299
|
+
style: selectContainerStyle,
|
|
300
|
+
ref: helpRefNarrow
|
|
301
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
302
|
+
className: selectClass,
|
|
303
|
+
style: _objectSpread(_objectSpread({}, selectColorStyle), {}, {
|
|
304
|
+
marginRight: 15
|
|
305
|
+
}),
|
|
306
|
+
value: documentView[side].transcriptionType,
|
|
307
|
+
id: "doc-type",
|
|
308
|
+
onClick: changeType
|
|
309
|
+
}, Object.keys(props.document.folios.find(function (fol) {
|
|
310
|
+
return fol.id == props.documentView[props.side].iiifShortID;
|
|
311
|
+
}).annotationURLs).map(function (ttKey) {
|
|
312
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
313
|
+
value: ttKey,
|
|
314
|
+
key: ttKey
|
|
315
|
+
}, props.document.variorum ? props.document.transcriptionTypes[props.document.folios.find(function (fol) {
|
|
316
|
+
return fol.id == props.documentView[props.side].iiifShortID;
|
|
317
|
+
}).doc_id][ttKey] : props.document.transcriptionTypes[ttKey]);
|
|
318
|
+
}), /*#__PURE__*/React.createElement(MenuItem, {
|
|
319
|
+
value: "f",
|
|
320
|
+
key: "f"
|
|
321
|
+
}, DocumentHelper.transcriptionTypeLabels.f), /*#__PURE__*/React.createElement(MenuItem, {
|
|
322
|
+
value: "glossary",
|
|
323
|
+
key: "glossary"
|
|
324
|
+
}, DocumentHelper.transcriptionTypeLabels.glossary)), /*#__PURE__*/React.createElement("span", {
|
|
325
|
+
title: "Toggle folio help",
|
|
326
|
+
onClick: toggleHelpNarrow,
|
|
327
|
+
className: "helpIcon"
|
|
328
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
329
|
+
className: "fas fa-question-circle"
|
|
330
|
+
})), /*#__PURE__*/React.createElement(HelpPopper, {
|
|
331
|
+
marginStyle: helpMarginStyle,
|
|
332
|
+
anchorEl: helpRefNarrow.current,
|
|
333
|
+
open: openHelpNarrow,
|
|
334
|
+
onClose: toggleHelpNarrow
|
|
335
|
+
})))));
|
|
238
336
|
};
|
|
239
337
|
function mapStateToProps(state) {
|
|
240
338
|
return {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
// create an inline spinner (uses Pure CSS Loaders: https://loading.io/css/)
|
|
10
|
+
export function InlineRingSpinner(foregroundColor) {
|
|
11
|
+
// color can be 'light' or 'dark'
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
className: "inline-ring-spinner"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: foregroundColor
|
|
16
|
+
}), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null));
|
|
17
|
+
}
|
|
18
|
+
export function BigRingSpinner(props) {
|
|
19
|
+
var _props$delay = props.delay,
|
|
20
|
+
delay = _props$delay === void 0 ? 0 : _props$delay,
|
|
21
|
+
_props$color = props.color,
|
|
22
|
+
color = _props$color === void 0 ? 'dark' : _props$color;
|
|
23
|
+
var _useState = useState(delay === 0),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
show = _useState2[0],
|
|
26
|
+
setShow = _useState2[1];
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (delay > 0) {
|
|
29
|
+
var timer = setTimeout(function () {
|
|
30
|
+
setShow(true);
|
|
31
|
+
}, delay);
|
|
32
|
+
return function () {
|
|
33
|
+
return clearTimeout(timer);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
return show ? /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "big-ring-spinner ".concat(color)
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null)) : /*#__PURE__*/React.createElement("div", null);
|
|
40
|
+
}
|
|
@@ -1,16 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
+
import { BigRingSpinner } from './RingSpinner';
|
|
2
12
|
var SeaDragonComponent = function SeaDragonComponent(props) {
|
|
3
13
|
var side = props.side,
|
|
4
14
|
initViewer = props.initViewer,
|
|
5
15
|
tileSource = props.tileSource;
|
|
16
|
+
var _useState = useState(true),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
loading = _useState2[0],
|
|
19
|
+
setLoading = _useState2[1];
|
|
20
|
+
var viewerRef = useRef(null);
|
|
21
|
+
useEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
if (!viewerRef.current) {
|
|
26
|
+
_context.next = 3;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
_context.next = 3;
|
|
30
|
+
return initViewer(viewerRef.current, tileSource).then(function () {
|
|
31
|
+
return setLoading(false);
|
|
32
|
+
});
|
|
33
|
+
case 3:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
})), []);
|
|
6
39
|
var viewer = useMemo(function () {
|
|
7
40
|
return /*#__PURE__*/React.createElement("div", {
|
|
8
41
|
id: "image-view-seadragon-".concat(side),
|
|
9
|
-
ref:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
42
|
+
ref: viewerRef
|
|
43
|
+
}, loading && /*#__PURE__*/React.createElement(BigRingSpinner, {
|
|
44
|
+
color: "light",
|
|
45
|
+
delay: 1000
|
|
46
|
+
}));
|
|
47
|
+
}, [loading]);
|
|
14
48
|
return viewer;
|
|
15
49
|
};
|
|
16
50
|
export default SeaDragonComponent;
|
|
@@ -12,14 +12,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
14
|
import { connect } from 'react-redux';
|
|
15
|
-
var
|
|
16
|
-
_inherits(
|
|
17
|
-
var _super = _createSuper(
|
|
18
|
-
function
|
|
19
|
-
_classCallCheck(this,
|
|
15
|
+
var SinglePaneView = /*#__PURE__*/function (_Component) {
|
|
16
|
+
_inherits(SinglePaneView, _Component);
|
|
17
|
+
var _super = _createSuper(SinglePaneView);
|
|
18
|
+
function SinglePaneView() {
|
|
19
|
+
_classCallCheck(this, SinglePaneView);
|
|
20
20
|
return _super.apply(this, arguments);
|
|
21
21
|
}
|
|
22
|
-
_createClass(
|
|
22
|
+
_createClass(SinglePaneView, [{
|
|
23
23
|
key: "render",
|
|
24
24
|
value: function render() {
|
|
25
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -27,11 +27,11 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
27
27
|
}, this.props.singlePane);
|
|
28
28
|
}
|
|
29
29
|
}]);
|
|
30
|
-
return
|
|
30
|
+
return SinglePaneView;
|
|
31
31
|
}(Component);
|
|
32
32
|
function mapStateToProps(state) {
|
|
33
33
|
return {
|
|
34
34
|
document: state.document
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export default connect(mapStateToProps)(
|
|
37
|
+
export default connect(mapStateToProps)(SinglePaneView);
|
|
@@ -25,49 +25,64 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
25
25
|
// On drag, update the UI continuously
|
|
26
26
|
_this.onDrag = function (e) {
|
|
27
27
|
if (_this.dragging) {
|
|
28
|
-
var whole = window.innerWidth - _this.dividerWidth;
|
|
29
|
-
var left_viewWidth
|
|
30
|
-
var right_viewWidth
|
|
31
|
-
|
|
28
|
+
var whole = window.innerWidth - 2 * _this.dividerWidth;
|
|
29
|
+
var left_viewWidth;
|
|
30
|
+
var right_viewWidth;
|
|
31
|
+
var third_viewWidth;
|
|
32
|
+
if (_this.activeDivider === 1) {
|
|
33
|
+
left_viewWidth = e.clientX - _this.dividerWidth / 2;
|
|
34
|
+
third_viewWidth = whole * _this.splitFractionRight;
|
|
35
|
+
right_viewWidth = whole - left_viewWidth - third_viewWidth;
|
|
36
|
+
} else {
|
|
37
|
+
third_viewWidth = whole - e.clientX - _this.dividerWidth / 2;
|
|
38
|
+
left_viewWidth = whole * _this.splitFraction;
|
|
39
|
+
right_viewWidth = whole - left_viewWidth - third_viewWidth;
|
|
40
|
+
}
|
|
32
41
|
// Update as long as we're within limits
|
|
33
|
-
if (left_viewWidth
|
|
42
|
+
if (left_viewWidth >= _this.leftPaneMinWidth && right_viewWidth >= _this.rightPaneMinWidth && third_viewWidth >= _this.thirdPaneMinWidth) {
|
|
34
43
|
_this.splitFraction = whole === 0 ? 0.0 : left_viewWidth / whole;
|
|
44
|
+
_this.splitFractionRight = whole === 0 ? 0.0 : third_viewWidth / whole;
|
|
35
45
|
_this.updateUI();
|
|
36
46
|
}
|
|
37
47
|
_this.updatePaneSize();
|
|
38
48
|
}
|
|
39
49
|
};
|
|
40
50
|
// Drag start: mark it
|
|
41
|
-
_this.onStartDrag = function (
|
|
51
|
+
_this.onStartDrag = function (position) {
|
|
42
52
|
_this.dragging = true;
|
|
53
|
+
_this.activeDivider = position === 'first' ? 1 : 2;
|
|
43
54
|
};
|
|
44
55
|
// Drag end
|
|
45
56
|
_this.onEndDrag = function (e) {
|
|
46
57
|
_this.dragging = false;
|
|
58
|
+
_this.activeDivider = 0;
|
|
47
59
|
};
|
|
48
60
|
// On window resize
|
|
49
61
|
_this.onResize = function (e) {
|
|
50
62
|
_this.updatePaneSize();
|
|
51
63
|
};
|
|
52
64
|
_this.firstFolio = props.document.folios[0];
|
|
53
|
-
|
|
54
65
|
// Initialize the splitter
|
|
55
|
-
_this.rightPaneMinWidth = 200;
|
|
56
|
-
_this.leftPaneMinWidth = 200;
|
|
57
|
-
_this.
|
|
66
|
+
_this.rightPaneMinWidth = props.rightPane.props.documentView.right.transcriptionType === "glossary" ? 450 : 200;
|
|
67
|
+
_this.leftPaneMinWidth = props.leftPane.props.documentView.left.transcriptionType === "glossary" ? 450 : 200;
|
|
68
|
+
_this.thirdPaneMinWidth = props.thirdPane.props.documentView.third.transcriptionType === "glossary" ? 450 : props.thirdPane.props.documentView.third.transcriptionType === "g" ? 0 : 200;
|
|
69
|
+
_this.splitFraction = props.threePanel ? 0.49 : 0.5;
|
|
70
|
+
_this.splitFractionRight = props.threePanel ? 0.01 : 0;
|
|
58
71
|
_this.dividerWidth = 16;
|
|
59
72
|
var _whole = window.innerWidth;
|
|
60
|
-
var leftW = _whole /
|
|
73
|
+
var leftW = _whole / 3;
|
|
61
74
|
var split_left = leftW / _whole;
|
|
62
|
-
var split_right = 1 - split_left;
|
|
75
|
+
var split_right = (1 - split_left) / 2;
|
|
76
|
+
var split_third = 1 - split_left - split_right;
|
|
63
77
|
_this.state = {
|
|
64
78
|
style: {
|
|
65
|
-
gridTemplateColumns: "".concat(split_left, "fr ").concat(_this.dividerWidth, "px ").concat(split_right, "fr")
|
|
79
|
+
gridTemplateColumns: "".concat(split_left, "fr ").concat(_this.dividerWidth, "px ").concat(split_right, "fr ").concat(_this.dividerWidth, "px ").concat(split_third, "fr")
|
|
66
80
|
}
|
|
67
81
|
};
|
|
68
82
|
|
|
69
83
|
// event handlers
|
|
70
84
|
_this.dragging = false;
|
|
85
|
+
_this.activeDivider = 0;
|
|
71
86
|
_this.onDrag = _this.onDrag.bind(_assertThisInitialized(_this));
|
|
72
87
|
_this.onResize = _this.onResize.bind(_assertThisInitialized(_this));
|
|
73
88
|
_this.onEndDrag = _this.onEndDrag.bind(_assertThisInitialized(_this));
|
|
@@ -81,10 +96,11 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
81
96
|
// Update the screen with the new split info
|
|
82
97
|
function updateUI() {
|
|
83
98
|
var left = this.splitFraction;
|
|
84
|
-
var
|
|
99
|
+
var third = this.splitFractionRight;
|
|
100
|
+
var right = 1.0 - left - third;
|
|
85
101
|
this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
|
|
86
102
|
style: _objectSpread(_objectSpread({}, this.state.style), {}, {
|
|
87
|
-
gridTemplateColumns: "".concat(left, "fr ").concat(this.dividerWidth, "px ").concat(right, "fr")
|
|
103
|
+
gridTemplateColumns: "".concat(left, "fr ").concat(this.dividerWidth, "px ").concat(right, "fr ").concat(this.dividerWidth, "px ").concat(third, "fr")
|
|
88
104
|
})
|
|
89
105
|
}));
|
|
90
106
|
}
|
|
@@ -95,9 +111,10 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
95
111
|
value: function updatePaneSize() {
|
|
96
112
|
// Record state change
|
|
97
113
|
var left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction));
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
var third_px = Math.floor(Math.abs(window.innerWidth * this.splitFractionRight));
|
|
115
|
+
var right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction - this.splitFractionRight));
|
|
116
|
+
if (this.props.onWidth && left_px >= this.leftPaneMinWidth && right_px >= this.rightPaneMinWidth && third_px >= this.thirdPaneMinWidth) {
|
|
117
|
+
this.props.onWidth(left_px, right_px, third_px);
|
|
101
118
|
}
|
|
102
119
|
}
|
|
103
120
|
}, {
|
|
@@ -107,14 +124,22 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
107
124
|
window.addEventListener('mousemove', this.onDrag);
|
|
108
125
|
window.addEventListener('mouseup', this.onEndDrag);
|
|
109
126
|
window.addEventListener('resize', this.onResize);
|
|
110
|
-
|
|
127
|
+
console.log(this.props);
|
|
111
128
|
// Set the default width on mount
|
|
112
129
|
if (this.props.onWidth) {
|
|
113
130
|
var left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction));
|
|
114
131
|
var right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
|
|
115
|
-
|
|
132
|
+
var third_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
|
|
133
|
+
this.props.onWidth(left_px, right_px, third_px);
|
|
116
134
|
}
|
|
117
135
|
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "componentDidUpdate",
|
|
138
|
+
value: function componentDidUpdate(prevProps) {
|
|
139
|
+
this.rightPaneMinWidth = this.props.rightPane.props.documentView.right.transcriptionType === "glossary" ? 450 : 200;
|
|
140
|
+
this.leftPaneMinWidth = this.props.leftPane.props.documentView.left.transcriptionType === "glossary" ? 450 : 200;
|
|
141
|
+
this.thirdPaneMinWidth = this.props.thirdPane.props.documentView.third.transcriptionType === "glossary" ? 450 : this.props.thirdPane.props.documentView.third.transcriptionType === "g" ? 0 : 200;
|
|
142
|
+
}
|
|
118
143
|
}, {
|
|
119
144
|
key: "componentWillUnmount",
|
|
120
145
|
value: function componentWillUnmount() {
|
|
@@ -124,11 +149,14 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
124
149
|
}
|
|
125
150
|
}, {
|
|
126
151
|
key: "renderDivider",
|
|
127
|
-
value: function renderDivider() {
|
|
152
|
+
value: function renderDivider(position) {
|
|
153
|
+
var _this2 = this;
|
|
128
154
|
var drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x';
|
|
129
155
|
return /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: "divider",
|
|
131
|
-
onMouseDown:
|
|
156
|
+
className: "divider ".concat(position, "_divider"),
|
|
157
|
+
onMouseDown: function onMouseDown() {
|
|
158
|
+
return _this2.onStartDrag(position);
|
|
159
|
+
}
|
|
132
160
|
}, /*#__PURE__*/React.createElement("div", {
|
|
133
161
|
className: "drawer-button hidden",
|
|
134
162
|
onClick: this.onDrawerButton
|
|
@@ -140,9 +168,9 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
|
140
168
|
key: "render",
|
|
141
169
|
value: function render() {
|
|
142
170
|
return /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: "split-pane-view",
|
|
171
|
+
className: "split-pane-view three-pane",
|
|
144
172
|
style: _objectSpread({}, this.state.style)
|
|
145
|
-
}, this.props.leftPane, this.renderDivider(), this.props.rightPane);
|
|
173
|
+
}, this.props.leftPane, this.renderDivider('first'), this.props.rightPane, this.props.threePanel && this.renderDivider('second'), this.props.threePanel && this.props.thirdPane);
|
|
146
174
|
}
|
|
147
175
|
}]);
|
|
148
176
|
return SplitPaneView;
|