@ldelia/react-media 0.4.1 → 0.4.3

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.
Files changed (149) hide show
  1. package/dist/components/__tests__/timeline/timeline.test.js +5 -10
  2. package/dist/components/index.js +2 -17
  3. package/dist/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.js +16 -44
  4. package/dist/components/timeline/Timeline.js +26 -56
  5. package/dist/components/timeline/TimelineCanvas/TickTime.js +5 -10
  6. package/dist/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.js +9 -14
  7. package/dist/components/timeline/TimelineCanvas/TimelineCanvas.js +16 -44
  8. package/dist/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.js +4 -8
  9. package/dist/components/timeline/TimelineValue/TimelineValue.js +24 -54
  10. package/dist/components/timeline/ZoomContext/ZoomContext.js +2 -8
  11. package/dist/components/timeline/constants.js +1 -4
  12. package/dist/components/timeline/index.js +1 -17
  13. package/dist/components/timeline/utils/utils.js +6 -15
  14. package/dist/index.js +1 -17
  15. package/dist/setupTests.js +1 -3
  16. package/dist/stories/timeline.stories.js +18 -24
  17. package/package.json +45 -35
  18. package/.bitmap +0 -48
  19. package/.eslintcache +0 -1
  20. package/.prettierignore +0 -3
  21. package/.prettierrc +0 -7
  22. package/.storybook/main.js +0 -38
  23. package/.storybook/preview.js +0 -4
  24. package/config/env.js +0 -104
  25. package/config/getHttpsConfig.js +0 -66
  26. package/config/jest/babelTransform.js +0 -29
  27. package/config/jest/cssTransform.js +0 -14
  28. package/config/jest/fileTransform.js +0 -40
  29. package/config/modules.js +0 -134
  30. package/config/paths.js +0 -77
  31. package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  32. package/config/webpack.config.js +0 -755
  33. package/config/webpackDevServer.config.js +0 -127
  34. package/dist/components/__tests__/timeline/timeline.test.d.ts +0 -1
  35. package/dist/components/index.d.ts +0 -1
  36. package/dist/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.d.ts +0 -8
  37. package/dist/components/timeline/Timeline.d.ts +0 -12
  38. package/dist/components/timeline/TimelineCanvas/TickTime.d.ts +0 -7
  39. package/dist/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.d.ts +0 -6
  40. package/dist/components/timeline/TimelineCanvas/TimelineCanvas.d.ts +0 -7
  41. package/dist/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.d.ts +0 -2
  42. package/dist/components/timeline/TimelineValue/TimelineValue.d.ts +0 -7
  43. package/dist/components/timeline/ZoomContext/ZoomContext.d.ts +0 -7
  44. package/dist/components/timeline/constants.d.ts +0 -1
  45. package/dist/components/timeline/index.d.ts +0 -1
  46. package/dist/components/timeline/utils/utils.d.ts +0 -7
  47. package/dist/index.d.ts +0 -1
  48. package/dist/setupTests.d.ts +0 -1
  49. package/dist/stories/timeline.stories.d.ts +0 -9
  50. package/scripts/build.js +0 -217
  51. package/scripts/start.js +0 -154
  52. package/scripts/test.js +0 -52
  53. package/src/components/__tests__/timeline/timeline.test.js +0 -22
  54. package/src/components/__tests__/timeline/timeline.test.tsx +0 -26
  55. package/src/components/index.js +0 -2
  56. package/src/components/index.ts +0 -2
  57. package/src/components/reproduction-widget/README.md +0 -27
  58. package/src/components/reproduction-widget/ReproductionWidget.tsx +0 -68
  59. package/src/components/reproduction-widget/index.tsx +0 -1
  60. package/src/components/reproduction-widget/inner-players/PlayAlongInnerPlayer.tsx +0 -10
  61. package/src/components/reproduction-widget/inner-players/YouTubeInnerPlayer.tsx +0 -36
  62. package/src/components/reproduction-widget/models/Player/PlayAlongPlayer.ts +0 -129
  63. package/src/components/reproduction-widget/models/Player/PlayerEvents.ts +0 -4
  64. package/src/components/reproduction-widget/models/Player/YouTubePlayer.ts +0 -171
  65. package/src/components/reproduction-widget/models/Reproduction.ts +0 -272
  66. package/src/components/reproduction-widget/models/ReproductionBuilder.ts +0 -70
  67. package/src/components/timeline/README.md +0 -111
  68. package/src/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.js +0 -127
  69. package/src/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.tsx +0 -166
  70. package/src/components/timeline/Timeline.js +0 -77
  71. package/src/components/timeline/Timeline.tsx +0 -139
  72. package/src/components/timeline/TimelineCanvas/TickTime.js +0 -26
  73. package/src/components/timeline/TimelineCanvas/TickTime.tsx +0 -45
  74. package/src/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.js +0 -19
  75. package/src/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.tsx +0 -42
  76. package/src/components/timeline/TimelineCanvas/TimelineCanvas.js +0 -44
  77. package/src/components/timeline/TimelineCanvas/TimelineCanvas.tsx +0 -79
  78. package/src/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.js +0 -28
  79. package/src/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.ts +0 -43
  80. package/src/components/timeline/TimelineValue/TimelineValue.js +0 -50
  81. package/src/components/timeline/TimelineValue/TimelineValue.tsx +0 -87
  82. package/src/components/timeline/ZoomContext/ZoomContext.js +0 -2
  83. package/src/components/timeline/ZoomContext/ZoomContext.ts +0 -10
  84. package/src/components/timeline/constants.js +0 -13
  85. package/src/components/timeline/constants.ts +0 -13
  86. package/src/components/timeline/index.js +0 -1
  87. package/src/components/timeline/index.tsx +0 -1
  88. package/src/components/timeline/utils/utils.js +0 -28
  89. package/src/components/timeline/utils/utils.ts +0 -49
  90. package/src/index.js +0 -1
  91. package/src/index.ts +0 -1
  92. package/src/modules.d.ts +0 -1
  93. package/src/react-app-env.d.ts +0 -71
  94. package/src/react-docgen-types.d.ts +0 -37
  95. package/src/setupTests.js +0 -5
  96. package/src/setupTests.ts +0 -5
  97. package/src/stories/Configure.mdx +0 -364
  98. package/src/stories/reproduction-widget.stories.tsx +0 -23
  99. package/src/stories/timeline.stories.custom.css +0 -29
  100. package/src/stories/timeline.stories.js +0 -54
  101. package/src/stories/timeline.stories.tsx +0 -66
  102. package/storybook-static/favicon.svg +0 -1
  103. package/storybook-static/index.html +0 -173
  104. package/storybook-static/index.json +0 -1
  105. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  106. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  107. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  108. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  109. package/storybook-static/project.json +0 -1
  110. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
  111. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
  112. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +0 -12
  113. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
  114. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -412
  115. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -0
  116. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +0 -3
  117. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
  118. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +0 -3
  119. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
  120. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +0 -3
  121. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
  122. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +0 -3
  123. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
  124. package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
  125. package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
  126. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
  127. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  128. package/storybook-static/sb-common-assets/favicon.svg +0 -1
  129. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  130. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  131. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  132. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  133. package/storybook-static/sb-manager/globals-module-info.js +0 -995
  134. package/storybook-static/sb-manager/globals-runtime.js +0 -53527
  135. package/storybook-static/sb-manager/globals.js +0 -48
  136. package/storybook-static/sb-manager/runtime.js +0 -11885
  137. package/storybook-static/sb-preview/globals.js +0 -33
  138. package/storybook-static/sb-preview/runtime.js +0 -9483
  139. package/tsconfig.json +0 -14
  140. /package/{src → dist}/components/reproduction-widget/ReproductionWidget.js +0 -0
  141. /package/{src → dist}/components/reproduction-widget/index.js +0 -0
  142. /package/{src → dist}/components/reproduction-widget/inner-players/PlayAlongInnerPlayer.js +0 -0
  143. /package/{src → dist}/components/reproduction-widget/inner-players/YouTubeInnerPlayer.js +0 -0
  144. /package/{src → dist}/components/reproduction-widget/models/Player/PlayAlongPlayer.js +0 -0
  145. /package/{src → dist}/components/reproduction-widget/models/Player/PlayerEvents.js +0 -0
  146. /package/{src → dist}/components/reproduction-widget/models/Player/YouTubePlayer.js +0 -0
  147. /package/{src → dist}/components/reproduction-widget/models/Reproduction.js +0 -0
  148. /package/{src → dist}/components/reproduction-widget/models/ReproductionBuilder.js +0 -0
  149. /package/{src → dist}/stories/reproduction-widget.stories.js +0 -0
@@ -1,11 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
- const client_1 = require("react-dom/client");
8
- const timeline_1 = require("../../timeline");
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { Timeline } from '../../timeline';
9
4
  describe('Timeline', () => {
10
5
  let props;
11
6
  beforeEach(() => {
@@ -20,8 +15,8 @@ describe('Timeline', () => {
20
15
  describe('render()', () => {
21
16
  it('renders a timeline', () => {
22
17
  const rootElement = document.createElement('div');
23
- const root = (0, client_1.createRoot)(rootElement);
24
- root.render(react_1.default.createElement(timeline_1.Timeline, Object.assign({}, props)));
18
+ const root = createRoot(rootElement);
19
+ root.render(React.createElement(Timeline, Object.assign({}, props)));
25
20
  });
26
21
  });
27
22
  });
@@ -1,17 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./timeline"), exports);
1
+ export * from './reproduction-widget';
2
+ export * from './timeline';
@@ -1,36 +1,8 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
30
- const styled_components_1 = __importDefault(require("styled-components"));
31
- const ZoomContext_1 = require("../ZoomContext/ZoomContext");
32
- const utils_1 = require("../utils/utils");
33
- const OverlayCanvas = styled_components_1.default.canvas `
1
+ import React, { useContext, useEffect, useMemo, useRef } from 'react';
2
+ import styled from 'styled-components';
3
+ import { ZoomContext } from '../ZoomContext/ZoomContext';
4
+ import { pixelToSeconds, secondsToPixel } from '../utils/utils';
5
+ const OverlayCanvas = styled.canvas `
34
6
  position: absolute;
35
7
  top: 0;
36
8
  left: 0;
@@ -39,14 +11,14 @@ const OverlayCanvas = styled_components_1.default.canvas `
39
11
  color: cadetblue;
40
12
  `;
41
13
  const RangeSelectorCanvas = ({ selectedRange, onChange, onRangeChange, }) => {
42
- const canvasRef = (0, react_1.useRef)(null);
43
- const zoomContextValue = (0, react_1.useContext)(ZoomContext_1.ZoomContext);
14
+ const canvasRef = useRef(null);
15
+ const zoomContextValue = useContext(ZoomContext);
44
16
  let isSelectingRange = false;
45
- let selectedRangeInPixels = (0, react_1.useMemo)(() => [], []);
17
+ let selectedRangeInPixels = useMemo(() => [], []);
46
18
  if (selectedRange.length === 2) {
47
19
  selectedRangeInPixels = [
48
- (0, utils_1.secondsToPixel)(zoomContextValue, selectedRange[0]),
49
- (0, utils_1.secondsToPixel)(zoomContextValue, selectedRange[1]),
20
+ secondsToPixel(zoomContextValue, selectedRange[0]),
21
+ secondsToPixel(zoomContextValue, selectedRange[1]),
50
22
  ];
51
23
  }
52
24
  let lastValidSelectedRangeInPixels = [];
@@ -67,7 +39,7 @@ const RangeSelectorCanvas = ({ selectedRange, onChange, onRangeChange, }) => {
67
39
  };
68
40
  const onCanvasDoubleClick = (e) => {
69
41
  const x0 = getMousePointerPixelPosition(e);
70
- onChange((0, utils_1.pixelToSeconds)(zoomContextValue, x0));
42
+ onChange(pixelToSeconds(zoomContextValue, x0));
71
43
  selectedRangeInPixels = lastValidSelectedRangeInPixels;
72
44
  };
73
45
  const isPixelNearSelectedRange = (x0) => {
@@ -136,12 +108,12 @@ const RangeSelectorCanvas = ({ selectedRange, onChange, onRangeChange, }) => {
136
108
  else {
137
109
  lastValidSelectedRangeInPixels = pixelRange;
138
110
  onRangeChange([
139
- (0, utils_1.pixelToSeconds)(zoomContextValue, pixelRange[0]),
140
- (0, utils_1.pixelToSeconds)(zoomContextValue, pixelRange[1]),
111
+ pixelToSeconds(zoomContextValue, pixelRange[0]),
112
+ pixelToSeconds(zoomContextValue, pixelRange[1]),
141
113
  ]);
142
114
  }
143
115
  };
144
- (0, react_1.useEffect)(() => {
116
+ useEffect(() => {
145
117
  const canvas = canvasRef.current;
146
118
  // https://stackoverflow.com/questions/8696631/canvas-drawings-like-lines-are-blurry
147
119
  canvas.width = canvas.offsetWidth;
@@ -150,6 +122,6 @@ const RangeSelectorCanvas = ({ selectedRange, onChange, onRangeChange, }) => {
150
122
  return;
151
123
  drawRect(selectedRangeInPixels[0], selectedRangeInPixels[1]);
152
124
  }, [selectedRangeInPixels]);
153
- return (react_1.default.createElement(OverlayCanvas, { ref: canvasRef, onDoubleClick: onCanvasDoubleClick, onMouseDown: onCanvasMouseDown, onMouseMove: onCanvasMouseMove, onMouseUp: onCanvasMouseUp, className: 'media-timeline-range-selector-canvas' }));
125
+ return (React.createElement(OverlayCanvas, { ref: canvasRef, onDoubleClick: onCanvasDoubleClick, onMouseDown: onCanvasMouseDown, onMouseMove: onCanvasMouseMove, onMouseUp: onCanvasMouseUp, className: 'media-timeline-range-selector-canvas' }));
154
126
  };
155
- exports.default = react_1.default.memo(RangeSelectorCanvas);
127
+ export default React.memo(RangeSelectorCanvas);
@@ -1,41 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Timeline = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const TimelineCanvas_1 = __importDefault(require("./TimelineCanvas/TimelineCanvas"));
32
- const RangeSelectorCanvas_1 = __importDefault(require("./RangeSelectorCanvas/RangeSelectorCanvas"));
33
- const constants_1 = require("./constants");
34
- const styled_components_1 = __importDefault(require("styled-components"));
35
- const TimelineValue_1 = require("./TimelineValue/TimelineValue");
36
- const ZoomContext_1 = require("./ZoomContext/ZoomContext");
37
- const utils_1 = require("./utils/utils");
38
- const TimelineContainer = styled_components_1.default.div `
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import TimelineCanvas from './TimelineCanvas/TimelineCanvas';
3
+ import RangeSelectorCanvas from './RangeSelectorCanvas/RangeSelectorCanvas';
4
+ import { zoomLevelConfigurations } from './constants';
5
+ import styled from 'styled-components';
6
+ import { TimelineValue } from './TimelineValue/TimelineValue';
7
+ import { ZoomContext } from './ZoomContext/ZoomContext';
8
+ import { getBlockOffsetForZoomLevel, getTimelineWrapperWidth, numberToPxString, } from './utils/utils';
9
+ const TimelineContainer = styled.div `
39
10
  background-color: #f0f0f0;
40
11
  border: 1px solid #c9c9c9;
41
12
  height: 80px;
@@ -45,7 +16,7 @@ const TimelineContainer = styled_components_1.default.div `
45
16
  position: relative;
46
17
  display: flex;
47
18
  `;
48
- const TimelineWrapper = styled_components_1.default.div `
19
+ const TimelineWrapper = styled.div `
49
20
  position: absolute;
50
21
  height: 100%;
51
22
  display: flex;
@@ -53,16 +24,16 @@ const TimelineWrapper = styled_components_1.default.div `
53
24
  align-items: center;
54
25
  overflow: hidden;
55
26
  `;
56
- const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTimeBlocks = true, onChange = () => { }, onRangeChange = () => { }, className = '', }) => {
57
- const timeLineContainerRef = (0, react_1.useRef)(null);
58
- const canvasRef = (0, react_1.useRef)(null);
59
- const [zoomContextValue, setZoomContextValue] = (0, react_1.useState)({
27
+ export const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTimeBlocks = true, onChange = () => { }, onRangeChange = () => { }, className = '', }) => {
28
+ const timeLineContainerRef = useRef(null);
29
+ const canvasRef = useRef(null);
30
+ const [zoomContextValue, setZoomContextValue] = useState({
60
31
  blockOffset: 0,
61
32
  pixelsInSecond: 0,
62
33
  timelineWrapperWidth: 0,
63
34
  });
64
35
  let zoomLevelValue = zoomLevel ? zoomLevel : 0;
65
- if (zoomLevelValue < 0 || zoomLevelValue >= constants_1.zoomLevelConfigurations.length) {
36
+ if (zoomLevelValue < 0 || zoomLevelValue >= zoomLevelConfigurations.length) {
66
37
  console.warn('Invalid value for property zoomLevel.');
67
38
  zoomLevelValue = 0;
68
39
  }
@@ -80,28 +51,27 @@ const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTime
80
51
  selectedRange = [];
81
52
  console.warn('The selected range is inconsistent.');
82
53
  }
83
- (0, react_1.useEffect)(() => {
54
+ useEffect(() => {
84
55
  if (!timeLineContainerRef.current)
85
56
  return;
86
- const timelineWrapperWidth = (0, utils_1.getTimelineWrapperWidth)(timeLineContainerRef.current.offsetWidth, zoomLevelValue);
57
+ const timelineWrapperWidth = getTimelineWrapperWidth(timeLineContainerRef.current.offsetWidth, zoomLevelValue);
87
58
  setZoomContextValue({
88
- blockOffset: (0, utils_1.getBlockOffsetForZoomLevel)(zoomLevelValue, duration, timelineWrapperWidth),
59
+ blockOffset: getBlockOffsetForZoomLevel(zoomLevelValue, duration, timelineWrapperWidth),
89
60
  pixelsInSecond: timelineWrapperWidth / duration,
90
61
  timelineWrapperWidth: timelineWrapperWidth,
91
62
  });
92
63
  }, [timeLineContainerRef.current, zoomLevelValue, duration]);
93
- (0, react_1.useEffect)(() => {
64
+ useEffect(() => {
94
65
  const timeLineWrapper = timeLineContainerRef.current;
95
66
  const scrollPosition = value * zoomContextValue.pixelsInSecond - 300;
96
67
  timeLineWrapper.scrollLeft = Math.max(0, scrollPosition);
97
68
  }, [duration, value, zoomContextValue]);
98
- return (react_1.default.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
99
- react_1.default.createElement(TimelineWrapper, { style: {
100
- width: (0, utils_1.numberToPxString)(zoomContextValue.timelineWrapperWidth),
69
+ return (React.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
70
+ React.createElement(TimelineWrapper, { style: {
71
+ width: numberToPxString(zoomContextValue.timelineWrapperWidth),
101
72
  } },
102
- react_1.default.createElement(ZoomContext_1.ZoomContext.Provider, { value: zoomContextValue },
103
- react_1.default.createElement(TimelineCanvas_1.default, { ref: canvasRef, duration: duration, withTimeBlocks: withTimeBlocks }),
104
- react_1.default.createElement(TimelineValue_1.TimelineValue, { value: value, canvasRef: canvasRef }),
105
- react_1.default.createElement(RangeSelectorCanvas_1.default, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange })))));
73
+ React.createElement(ZoomContext.Provider, { value: zoomContextValue },
74
+ React.createElement(TimelineCanvas, { ref: canvasRef, duration: duration, withTimeBlocks: withTimeBlocks }),
75
+ React.createElement(TimelineValue, { value: value, canvasRef: canvasRef }),
76
+ React.createElement(RangeSelectorCanvas, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange })))));
106
77
  };
107
- exports.Timeline = Timeline;
@@ -1,11 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
- const styled_components_1 = __importDefault(require("styled-components"));
8
- const TickTimeContainer = styled_components_1.default.span.attrs((props) => ({
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const TickTimeContainer = styled.span.attrs((props) => ({
9
4
  style: {
10
5
  left: props.left,
11
6
  },
@@ -23,9 +18,9 @@ const TickTime = ({ start, leftPosition }) => {
23
18
  const minutes = Math.floor(start / 60);
24
19
  let seconds = start - minutes * 60;
25
20
  let secondsFormatted = seconds < 10 ? '0' + seconds : seconds.toString();
26
- return (react_1.default.createElement(TickTimeContainer, { left: leftPosition, className: 'media-timeline-tick-time' },
21
+ return (React.createElement(TickTimeContainer, { left: leftPosition, className: 'media-timeline-tick-time' },
27
22
  minutes,
28
23
  ":",
29
24
  secondsFormatted));
30
25
  };
31
- exports.default = TickTime;
26
+ export default TickTime;
@@ -1,24 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
- const styled_components_1 = __importDefault(require("styled-components"));
8
- const TickTime_1 = __importDefault(require("./TickTime"));
9
- const ZoomContext_1 = require("../ZoomContext/ZoomContext");
10
- const TickTimeCollectionDisplayContainer = styled_components_1.default.div `
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import TickTime from './TickTime';
4
+ import { ZoomContext } from '../ZoomContext/ZoomContext';
5
+ const TickTimeCollectionDisplayContainer = styled.div `
11
6
  position: absolute;
12
7
  display: flex;
13
8
  align-self: flex-end;
14
9
  height: 100%;
15
10
  `;
16
11
  const TickTimeCollectionDisplay = ({ tickTimes = [], }) => {
17
- return (react_1.default.createElement(ZoomContext_1.ZoomContext.Consumer, null, (value) => {
18
- return (react_1.default.createElement(TickTimeCollectionDisplayContainer, null, tickTimes.map((tickTimeValue, index) => {
12
+ return (React.createElement(ZoomContext.Consumer, null, (value) => {
13
+ return (React.createElement(TickTimeCollectionDisplayContainer, null, tickTimes.map((tickTimeValue, index) => {
19
14
  const leftPosition = tickTimeValue * value.pixelsInSecond + 'px';
20
- return (react_1.default.createElement(TickTime_1.default, { key: index, start: tickTimeValue, leftPosition: leftPosition }));
15
+ return (React.createElement(TickTime, { key: index, start: tickTimeValue, leftPosition: leftPosition }));
21
16
  })));
22
17
  }));
23
18
  };
24
- exports.default = TickTimeCollectionDisplay;
19
+ export default TickTimeCollectionDisplay;
@@ -1,37 +1,9 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
30
- const styled_components_1 = __importDefault(require("styled-components"));
31
- const ZoomContext_1 = require("../ZoomContext/ZoomContext");
32
- const TickTimeCollectionDisplay_1 = __importDefault(require("./TickTimeCollectionDisplay"));
33
- const drawTimeBlocksOnCanvas_1 = require("./drawTimeBlocksOnCanvas");
34
- const OverlayCanvas = styled_components_1.default.canvas `
1
+ import React, { forwardRef, useContext, useEffect, useImperativeHandle, useRef, } from 'react';
2
+ import styled from 'styled-components';
3
+ import { ZoomContext } from '../ZoomContext/ZoomContext';
4
+ import TickTimeCollectionDisplay from './TickTimeCollectionDisplay';
5
+ import { drawTimeBlocksOnCanvas } from './drawTimeBlocksOnCanvas';
6
+ const OverlayCanvas = styled.canvas `
35
7
  position: absolute;
36
8
  top: 0;
37
9
  left: 0;
@@ -39,9 +11,9 @@ const OverlayCanvas = styled_components_1.default.canvas `
39
11
  height: 100%;
40
12
  color: #c9c9c9;
41
13
  `;
42
- const TimelineCanvas = (0, react_1.forwardRef)(({ duration, withTimeBlocks }, ref) => {
43
- const internalCanvasRef = (0, react_1.useRef)(null);
44
- const zoomContextValue = (0, react_1.useContext)(ZoomContext_1.ZoomContext);
14
+ const TimelineCanvas = forwardRef(({ duration, withTimeBlocks }, ref) => {
15
+ const internalCanvasRef = useRef(null);
16
+ const zoomContextValue = useContext(ZoomContext);
45
17
  const blockStartingTimes = (() => {
46
18
  if (!withTimeBlocks || !zoomContextValue.blockOffset)
47
19
  return [];
@@ -56,17 +28,17 @@ const TimelineCanvas = (0, react_1.forwardRef)(({ duration, withTimeBlocks }, re
56
28
  return blockStartingTimes;
57
29
  })();
58
30
  // Pass the internal ref's current value directly to the forwarded ref
59
- (0, react_1.useImperativeHandle)(ref, () => internalCanvasRef.current);
60
- (0, react_1.useEffect)(() => {
31
+ useImperativeHandle(ref, () => internalCanvasRef.current);
32
+ useEffect(() => {
61
33
  const canvas = internalCanvasRef.current;
62
34
  // https://stackoverflow.com/questions/8696631/canvas-drawings-like-lines-are-blurry
63
35
  canvas.width = canvas.offsetWidth;
64
36
  canvas.height = canvas.offsetHeight;
65
37
  if (withTimeBlocks)
66
- (0, drawTimeBlocksOnCanvas_1.drawTimeBlocksOnCanvas)(canvas, blockStartingTimes, zoomContextValue);
38
+ drawTimeBlocksOnCanvas(canvas, blockStartingTimes, zoomContextValue);
67
39
  }, [blockStartingTimes, withTimeBlocks, zoomContextValue]);
68
- return (react_1.default.createElement(react_1.default.Fragment, null,
69
- react_1.default.createElement(OverlayCanvas, { ref: internalCanvasRef, className: 'media-timeline-value-line-canvas' }),
70
- withTimeBlocks && (react_1.default.createElement(TickTimeCollectionDisplay_1.default, { tickTimes: blockStartingTimes }))));
40
+ return (React.createElement(React.Fragment, null,
41
+ React.createElement(OverlayCanvas, { ref: internalCanvasRef, className: 'media-timeline-value-line-canvas' }),
42
+ withTimeBlocks && (React.createElement(TickTimeCollectionDisplay, { tickTimes: blockStartingTimes }))));
71
43
  });
72
- exports.default = TimelineCanvas;
44
+ export default TimelineCanvas;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawTimeBlocksOnCanvas = void 0;
4
- const utils_1 = require("../utils/utils");
5
- const drawTimeBlocksOnCanvas = (canvas, blockStartingTimes, zoomContextValue) => {
1
+ import { secondsToPixel } from '../utils/utils';
2
+ export const drawTimeBlocksOnCanvas = (canvas, blockStartingTimes, zoomContextValue) => {
6
3
  const blockHeight = 20;
7
4
  const context = canvas.getContext('2d');
8
5
  // draw top line
@@ -14,8 +11,8 @@ const drawTimeBlocksOnCanvas = (canvas, blockStartingTimes, zoomContextValue) =>
14
11
  .getPropertyValue('color');
15
12
  context.stroke();
16
13
  for (const blockStartingTime of blockStartingTimes) {
17
- const x0Pixel = (0, utils_1.secondsToPixel)(zoomContextValue, blockStartingTime);
18
- const x1Pixel = (0, utils_1.secondsToPixel)(zoomContextValue, blockStartingTime + zoomContextValue.blockOffset);
14
+ const x0Pixel = secondsToPixel(zoomContextValue, blockStartingTime);
15
+ const x1Pixel = secondsToPixel(zoomContextValue, blockStartingTime + zoomContextValue.blockOffset);
19
16
  context.beginPath();
20
17
  // draw left line
21
18
  context.moveTo(x0Pixel, canvas.height);
@@ -29,4 +26,3 @@ const drawTimeBlocksOnCanvas = (canvas, blockStartingTimes, zoomContextValue) =>
29
26
  context.stroke();
30
27
  }
31
28
  };
32
- exports.drawTimeBlocksOnCanvas = drawTimeBlocksOnCanvas;
@@ -1,80 +1,50 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.TimelineValue = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const styled_components_1 = __importDefault(require("styled-components"));
32
- const utils_1 = require("../utils/utils");
33
- const ZoomContext_1 = require("../ZoomContext/ZoomContext");
34
- const PreValueLine = styled_components_1.default.span `
1
+ import React, { useCallback, useContext, useEffect, useRef } from 'react';
2
+ import styled from 'styled-components';
3
+ import { getComputedElementWidth, numberToPxString, secondsToPixel, } from '../utils/utils';
4
+ import { ZoomContext } from '../ZoomContext/ZoomContext';
5
+ const PreValueLine = styled.span `
35
6
  position: absolute;
36
7
  left: 0;
37
8
  height: 100%;
38
9
  `;
39
- const ValueLine = styled_components_1.default.span `
10
+ const ValueLine = styled.span `
40
11
  position: absolute;
41
12
  width: 1px;
42
13
  height: 100%;
43
14
  background-color: #575757;
44
15
  `;
45
- const PostValueLine = styled_components_1.default.span `
16
+ const PostValueLine = styled.span `
46
17
  position: absolute;
47
18
  height: 100%;
48
19
  `;
49
- const TimelineValue = ({ canvasRef, value }) => {
50
- const preValueLineRef = (0, react_1.useRef)(null);
51
- const valueLineRef = (0, react_1.useRef)(null);
52
- const postValueLineRef = (0, react_1.useRef)(null);
53
- const zoomContextValue = (0, react_1.useContext)(ZoomContext_1.ZoomContext);
54
- const showValueLine = (0, react_1.useCallback)(() => {
20
+ export const TimelineValue = ({ canvasRef, value }) => {
21
+ const preValueLineRef = useRef(null);
22
+ const valueLineRef = useRef(null);
23
+ const postValueLineRef = useRef(null);
24
+ const zoomContextValue = useContext(ZoomContext);
25
+ const showValueLine = useCallback(() => {
55
26
  const canvas = canvasRef.current;
56
27
  const preValueLineElement = preValueLineRef.current;
57
28
  const valueLineElement = valueLineRef.current;
58
29
  const postValueLineElement = postValueLineRef.current;
59
- const valueLineWidth = (0, utils_1.getComputedElementWidth)(valueLineElement);
60
- const linePosition = (0, utils_1.secondsToPixel)(zoomContextValue, value);
30
+ const valueLineWidth = getComputedElementWidth(valueLineElement);
31
+ const linePosition = secondsToPixel(zoomContextValue, value);
61
32
  const valueLinePositionBeginningConsideringWidth = linePosition - valueLineWidth / 2;
62
33
  // configure preValueLineElement
63
- preValueLineElement.style.width = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
34
+ preValueLineElement.style.width = numberToPxString(valueLinePositionBeginningConsideringWidth);
64
35
  // configure valueLineElement
65
- valueLineElement.style.left = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
36
+ valueLineElement.style.left = numberToPxString(valueLinePositionBeginningConsideringWidth);
66
37
  // configure postValueLineElement
67
38
  const postValueLinePosition = valueLinePositionBeginningConsideringWidth + valueLineWidth;
68
39
  const postValueLineWidth = canvas.width - postValueLinePosition;
69
- postValueLineElement.style.left = (0, utils_1.numberToPxString)(postValueLinePosition);
70
- postValueLineElement.style.width = (0, utils_1.numberToPxString)(postValueLineWidth);
40
+ postValueLineElement.style.left = numberToPxString(postValueLinePosition);
41
+ postValueLineElement.style.width = numberToPxString(postValueLineWidth);
71
42
  }, [canvasRef, value, zoomContextValue]);
72
- (0, react_1.useEffect)(() => {
43
+ useEffect(() => {
73
44
  showValueLine();
74
45
  }, [showValueLine]);
75
- return (react_1.default.createElement(react_1.default.Fragment, null,
76
- react_1.default.createElement(PreValueLine, { ref: preValueLineRef, className: 'media-timeline-pre-value-line' }),
77
- react_1.default.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' }),
78
- react_1.default.createElement(PostValueLine, { ref: postValueLineRef, className: 'media-timeline-post-value-line' })));
46
+ return (React.createElement(React.Fragment, null,
47
+ React.createElement(PreValueLine, { ref: preValueLineRef, className: 'media-timeline-pre-value-line' }),
48
+ React.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' }),
49
+ React.createElement(PostValueLine, { ref: postValueLineRef, className: 'media-timeline-post-value-line' })));
79
50
  };
80
- exports.TimelineValue = TimelineValue;
@@ -1,8 +1,2 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ZoomContext = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- exports.ZoomContext = react_1.default.createContext(null);
1
+ import React from 'react';
2
+ export const ZoomContext = React.createContext(null);
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zoomLevelConfigurations = void 0;
4
1
  //[blockOffset, pixelsInSecond] when zoomLevel === 0, each block has an offset of 20 seconds, and each second has a width of 7px.
5
- exports.zoomLevelConfigurations = [
2
+ export const zoomLevelConfigurations = [
6
3
  [20, 7],
7
4
  [10, 10],
8
5
  [10, 15],
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Timeline"), exports);
1
+ export * from './Timeline';
@@ -1,32 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBlockOffsetForZoomLevel = exports.getTimelineWrapperWidth = exports.numberToPxString = exports.getComputedElementWidth = exports.pixelToSeconds = exports.secondsToPixel = void 0;
4
- const secondsToPixel = (zoomContextValue, seconds) => {
1
+ export const secondsToPixel = (zoomContextValue, seconds) => {
5
2
  return zoomContextValue.pixelsInSecond * seconds;
6
3
  };
7
- exports.secondsToPixel = secondsToPixel;
8
- const pixelToSeconds = (zoomContextValue, pixel) => {
4
+ export const pixelToSeconds = (zoomContextValue, pixel) => {
9
5
  const seconds = pixel / zoomContextValue.pixelsInSecond;
10
6
  return Math.round((seconds + Number.EPSILON) * 100) / 100;
11
7
  };
12
- exports.pixelToSeconds = pixelToSeconds;
13
- const getComputedElementWidth = (element) => {
8
+ export const getComputedElementWidth = (element) => {
14
9
  const elementWidthCSSProperty = window
15
10
  .getComputedStyle(element)
16
11
  .getPropertyValue('width')
17
12
  .replace(/[^-\d]/g, '');
18
13
  return parseInt(elementWidthCSSProperty);
19
14
  };
20
- exports.getComputedElementWidth = getComputedElementWidth;
21
- const numberToPxString = (number) => {
15
+ export const numberToPxString = (number) => {
22
16
  return `${number}px`;
23
17
  };
24
- exports.numberToPxString = numberToPxString;
25
- const getTimelineWrapperWidth = (timeLineContainerWidth, zoomLevel) => {
18
+ export const getTimelineWrapperWidth = (timeLineContainerWidth, zoomLevel) => {
26
19
  return timeLineContainerWidth * Math.pow(1.25, zoomLevel) - 2; //-2px to account for the border
27
20
  };
28
- exports.getTimelineWrapperWidth = getTimelineWrapperWidth;
29
- function getBlockOffsetForZoomLevel(zoomLevel, duration, timelineWrapperWidth) {
21
+ export function getBlockOffsetForZoomLevel(zoomLevel, duration, timelineWrapperWidth) {
30
22
  const offsets = [10, 5, 5, 5, 2, 2, 2, 2, 2, 1];
31
23
  let optimalOffset = offsets[zoomLevel];
32
24
  while ((duration / optimalOffset) * 40 > timelineWrapperWidth) {
@@ -34,4 +26,3 @@ function getBlockOffsetForZoomLevel(zoomLevel, duration, timelineWrapperWidth) {
34
26
  }
35
27
  return Math.ceil(optimalOffset);
36
28
  }
37
- exports.getBlockOffsetForZoomLevel = getBlockOffsetForZoomLevel;