修复代码错误;修复属性查询无时间轴情况下也能查询的问题;修复工具栏定位错误的问题
This commit is contained in:
@@ -290,7 +290,7 @@ const Timeline: React.FC = () => {
|
||||
// 添加 useEffect 来监听 currentTime 和 selectedDate 的变化,并获取数据
|
||||
useEffect(() => {
|
||||
// 首次加载时,如果 selectedDate 或 currentTime 未定义,则跳过执行,避免报错
|
||||
if (selectedDate && currentTime !== undefined) {
|
||||
if (selectedDate && currentTime !== undefined && currentTime !== -1) {
|
||||
// 检查至少一个属性有值
|
||||
const junctionProperties = junctionText;
|
||||
const pipeProperties = pipeText;
|
||||
@@ -311,6 +311,8 @@ const Timeline: React.FC = () => {
|
||||
|
||||
// 组件卸载时清理定时器和防抖
|
||||
useEffect(() => {
|
||||
setCurrentTime(0); // 组件卸载时重置时间
|
||||
|
||||
return () => {
|
||||
if (intervalRef.current) {
|
||||
clearInterval(intervalRef.current);
|
||||
|
||||
@@ -454,8 +454,8 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons }) => {
|
||||
setComputedProperties({});
|
||||
}
|
||||
};
|
||||
|
||||
queryComputedProperties();
|
||||
// 仅当 currentTime 有效时查询
|
||||
if (currentTime !== -1) queryComputedProperties();
|
||||
}, [highlightFeature, currentTime, selectedDate]);
|
||||
|
||||
// 从要素属性中提取属性面板需要的数据
|
||||
|
||||
Reference in New Issue
Block a user