sense-react-timeline-editor 1.1.27 → 1.1.29
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/index.esm.js +15 -7
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, cloneElement, useImperativeHandle, useState, useLayoutEffect, useCallback, useMemo, memo, forwardRef } from 'react';
|
|
2
2
|
import { AutoSizer, Grid, ScrollSync } from 'react-virtualized';
|
|
3
|
-
import { useThrottleEffect } from 'ahooks';
|
|
3
|
+
import { useThrottleEffect, useThrottleFn } from 'ahooks';
|
|
4
4
|
import { prefixNames } from 'framework-utils';
|
|
5
5
|
import interact from 'interactjs';
|
|
6
6
|
import { useSelectionContainer } from '@air/react-drag-to-select';
|
|
@@ -756,7 +756,7 @@ var TimelineEngine = /*#__PURE__*/function (_Emitter) {
|
|
|
756
756
|
var actionId = this._activeActionIds[i];
|
|
757
757
|
var action = this._actionMap[actionId];
|
|
758
758
|
// 不在播放区域内
|
|
759
|
-
if (action.start > time || action.end
|
|
759
|
+
if (action.start > time || action.end <= time) {
|
|
760
760
|
var _effect$source6;
|
|
761
761
|
var effect = this._effectMap[action.effectId];
|
|
762
762
|
if (effect && ((_effect$source6 = effect.source) === null || _effect$source6 === void 0 ? void 0 : _effect$source6.leave)) {
|
|
@@ -4362,6 +4362,7 @@ var TimeArea = function TimeArea(_ref) {
|
|
|
4362
4362
|
var estColumnWidth = getColumnWidth({
|
|
4363
4363
|
index: 1
|
|
4364
4364
|
});
|
|
4365
|
+
console.log('estColumnWidth', estColumnWidth, ', scrollLeft = ', scrollLeft);
|
|
4365
4366
|
return /*#__PURE__*/React.createElement("div", {
|
|
4366
4367
|
className: prefix('time-area')
|
|
4367
4368
|
}, /*#__PURE__*/React.createElement(AutoSizer, null, function (_ref3) {
|
|
@@ -4391,13 +4392,10 @@ var TimeArea = function TimeArea(_ref) {
|
|
|
4391
4392
|
height: height
|
|
4392
4393
|
},
|
|
4393
4394
|
onClick: function onClick(e) {
|
|
4394
|
-
var _timelineEditorEl$scr;
|
|
4395
4395
|
if (hideCursor) return;
|
|
4396
|
-
var timelineEditorEl = document.querySelector('.timeline-editor');
|
|
4397
4396
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
4398
4397
|
var position = e.clientX - rect.x;
|
|
4399
|
-
var
|
|
4400
|
-
var left = Math.max(position + actualScrollLeft, startLeft);
|
|
4398
|
+
var left = Math.max(position, startLeft);
|
|
4401
4399
|
if (left > maxScaleCount * scaleWidth + startLeft) return;
|
|
4402
4400
|
var time = parserPixelToTime(left, {
|
|
4403
4401
|
startLeft: startLeft,
|
|
@@ -4801,6 +4799,12 @@ var Timeline = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (p
|
|
|
4801
4799
|
target: target,
|
|
4802
4800
|
evt: e
|
|
4803
4801
|
});
|
|
4802
|
+
if (target.closest('#time-editor-container')) {
|
|
4803
|
+
// @ts-expect-error 类型断言
|
|
4804
|
+
var event = e;
|
|
4805
|
+
throttledOnClickTimeline(event);
|
|
4806
|
+
return;
|
|
4807
|
+
}
|
|
4804
4808
|
};
|
|
4805
4809
|
document.addEventListener('mousedown', handleClickOutside);
|
|
4806
4810
|
return function () {
|
|
@@ -4879,6 +4883,10 @@ var Timeline = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (p
|
|
|
4879
4883
|
updateTime: true
|
|
4880
4884
|
});
|
|
4881
4885
|
}, [startLeft, scale, scaleWidth, hideCursor, handleSetCursor]);
|
|
4886
|
+
var _useThrottleFn = useThrottleFn(onClickTimeline, {
|
|
4887
|
+
wait: 50
|
|
4888
|
+
}),
|
|
4889
|
+
throttledOnClickTimeline = _useThrottleFn.run;
|
|
4882
4890
|
// 监听timeline区域宽度变化
|
|
4883
4891
|
useEffect(function () {
|
|
4884
4892
|
if (areaRef.current) {
|
|
@@ -4985,7 +4993,7 @@ var Timeline = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (p
|
|
|
4985
4993
|
height: '100%',
|
|
4986
4994
|
background: '#fff'
|
|
4987
4995
|
},
|
|
4988
|
-
onClick:
|
|
4996
|
+
onClick: throttledOnClickTimeline
|
|
4989
4997
|
}, Object.keys(groupedData).map(function (key, index) {
|
|
4990
4998
|
var handleGroupDataChange = function handleGroupDataChange(updatedData) {
|
|
4991
4999
|
var mergedData = editorData.filter(function (item) {
|
package/dist/index.js
CHANGED
|
@@ -766,7 +766,7 @@ var TimelineEngine = /*#__PURE__*/function (_Emitter) {
|
|
|
766
766
|
var actionId = this._activeActionIds[i];
|
|
767
767
|
var action = this._actionMap[actionId];
|
|
768
768
|
// 不在播放区域内
|
|
769
|
-
if (action.start > time || action.end
|
|
769
|
+
if (action.start > time || action.end <= time) {
|
|
770
770
|
var _effect$source6;
|
|
771
771
|
var effect = this._effectMap[action.effectId];
|
|
772
772
|
if (effect && ((_effect$source6 = effect.source) === null || _effect$source6 === void 0 ? void 0 : _effect$source6.leave)) {
|
|
@@ -4372,6 +4372,7 @@ var TimeArea = function TimeArea(_ref) {
|
|
|
4372
4372
|
var estColumnWidth = getColumnWidth({
|
|
4373
4373
|
index: 1
|
|
4374
4374
|
});
|
|
4375
|
+
console.log('estColumnWidth', estColumnWidth, ', scrollLeft = ', scrollLeft);
|
|
4375
4376
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4376
4377
|
className: prefix('time-area')
|
|
4377
4378
|
}, /*#__PURE__*/React__default['default'].createElement(reactVirtualized.AutoSizer, null, function (_ref3) {
|
|
@@ -4401,13 +4402,10 @@ var TimeArea = function TimeArea(_ref) {
|
|
|
4401
4402
|
height: height
|
|
4402
4403
|
},
|
|
4403
4404
|
onClick: function onClick(e) {
|
|
4404
|
-
var _timelineEditorEl$scr;
|
|
4405
4405
|
if (hideCursor) return;
|
|
4406
|
-
var timelineEditorEl = document.querySelector('.timeline-editor');
|
|
4407
4406
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
4408
4407
|
var position = e.clientX - rect.x;
|
|
4409
|
-
var
|
|
4410
|
-
var left = Math.max(position + actualScrollLeft, startLeft);
|
|
4408
|
+
var left = Math.max(position, startLeft);
|
|
4411
4409
|
if (left > maxScaleCount * scaleWidth + startLeft) return;
|
|
4412
4410
|
var time = parserPixelToTime(left, {
|
|
4413
4411
|
startLeft: startLeft,
|
|
@@ -4811,6 +4809,12 @@ var Timeline = /*#__PURE__*/React__default['default'].memo(/*#__PURE__*/React__d
|
|
|
4811
4809
|
target: target,
|
|
4812
4810
|
evt: e
|
|
4813
4811
|
});
|
|
4812
|
+
if (target.closest('#time-editor-container')) {
|
|
4813
|
+
// @ts-expect-error 类型断言
|
|
4814
|
+
var event = e;
|
|
4815
|
+
throttledOnClickTimeline(event);
|
|
4816
|
+
return;
|
|
4817
|
+
}
|
|
4814
4818
|
};
|
|
4815
4819
|
document.addEventListener('mousedown', handleClickOutside);
|
|
4816
4820
|
return function () {
|
|
@@ -4889,6 +4893,10 @@ var Timeline = /*#__PURE__*/React__default['default'].memo(/*#__PURE__*/React__d
|
|
|
4889
4893
|
updateTime: true
|
|
4890
4894
|
});
|
|
4891
4895
|
}, [startLeft, scale, scaleWidth, hideCursor, handleSetCursor]);
|
|
4896
|
+
var _useThrottleFn = ahooks.useThrottleFn(onClickTimeline, {
|
|
4897
|
+
wait: 50
|
|
4898
|
+
}),
|
|
4899
|
+
throttledOnClickTimeline = _useThrottleFn.run;
|
|
4892
4900
|
// 监听timeline区域宽度变化
|
|
4893
4901
|
React.useEffect(function () {
|
|
4894
4902
|
if (areaRef.current) {
|
|
@@ -4995,7 +5003,7 @@ var Timeline = /*#__PURE__*/React__default['default'].memo(/*#__PURE__*/React__d
|
|
|
4995
5003
|
height: '100%',
|
|
4996
5004
|
background: '#fff'
|
|
4997
5005
|
},
|
|
4998
|
-
onClick:
|
|
5006
|
+
onClick: throttledOnClickTimeline
|
|
4999
5007
|
}, Object.keys(groupedData).map(function (key, index) {
|
|
5000
5008
|
var handleGroupDataChange = function handleGroupDataChange(updatedData) {
|
|
5001
5009
|
var mergedData = editorData.filter(function (item) {
|