fix ReplayButton
This commit is contained in:
parent
6eb4831866
commit
71b0025e5a
@ -31,7 +31,11 @@ function CustomFlyTo() {
|
|||||||
const barotorpic = {
|
const barotorpic = {
|
||||||
destination: Cartesian3.fromDegrees(60, 15, 15000000),
|
destination: Cartesian3.fromDegrees(60, 15, 15000000),
|
||||||
duration: 7,
|
duration: 7,
|
||||||
complete: () => {},
|
complete: () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
viewer.clock.shouldAnimate = false;
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
easingFunction: EasingFunction.LINEAR_NONE,
|
easingFunction: EasingFunction.LINEAR_NONE,
|
||||||
orientation: {
|
orientation: {
|
||||||
heading: 6.283,
|
heading: 6.283,
|
||||||
@ -69,7 +73,6 @@ function CustomFlyTo() {
|
|||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
viewer.clock.shouldAnimate = false;
|
|
||||||
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
}, [replayVersion]);
|
}, [replayVersion]);
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { Button } from "antd";
|
import { Button } from "antd";
|
||||||
|
import { useCesium } from "resium";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
|
|
||||||
export default function ReplayButton() {
|
export default function ReplayButton() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { viewer } = useCesium();
|
||||||
|
|
||||||
const playHandler = useCallback(() => {
|
const playHandler = useCallback(() => {
|
||||||
|
if (!viewer.clock.shouldAnimate)
|
||||||
dispatch.data.update({ replayVersion: Date.now() });
|
dispatch.data.update({ replayVersion: Date.now() });
|
||||||
}, []);
|
}, [viewer]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.replayButton}>
|
<div className={styles.replayButton}>
|
||||||
|
@ -87,6 +87,11 @@ export default function CustomFlyTo() {
|
|||||||
pitch: -1.3,
|
pitch: -1.3,
|
||||||
roll: 0,
|
roll: 0,
|
||||||
},
|
},
|
||||||
|
complete: () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
viewer.clock.shouldAnimate = false;
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
easingFunction: EasingFunction.LINEAR_NONE,
|
easingFunction: EasingFunction.LINEAR_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +100,6 @@ export default function CustomFlyTo() {
|
|||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
viewer.clock.shouldAnimate = false;
|
|
||||||
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
}, [replayVersion]);
|
}, [replayVersion]);
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { Button } from "antd";
|
import { Button } from "antd";
|
||||||
|
import { useCesium } from "resium";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
|
|
||||||
export default function ReplayButton() {
|
export default function ReplayButton() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { viewer } = useCesium();
|
||||||
|
|
||||||
const playHandler = useCallback(() => {
|
const playHandler = useCallback(() => {
|
||||||
|
if (!viewer.clock.shouldAnimate)
|
||||||
dispatch.data.update({ replayVersion: Date.now() });
|
dispatch.data.update({ replayVersion: Date.now() });
|
||||||
}, []);
|
}, [viewer]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.replayButton}>
|
<div className={styles.replayButton}>
|
||||||
|
@ -114,6 +114,11 @@ function CustomFlyTo() {
|
|||||||
roll: -6,
|
roll: -6,
|
||||||
},
|
},
|
||||||
easingFunction: EasingFunction.LINEAR_NONE,
|
easingFunction: EasingFunction.LINEAR_NONE,
|
||||||
|
complete: () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
viewer.clock.shouldAnimate = false;
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
camera.flyTo(area1Options);
|
camera.flyTo(area1Options);
|
||||||
@ -121,7 +126,6 @@ function CustomFlyTo() {
|
|||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
viewer.clock.shouldAnimate = false;
|
|
||||||
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
viewer.clock.currentTime = viewer.clock.startTime.clone();
|
||||||
cameraFlyToLine();
|
cameraFlyToLine();
|
||||||
}, [replayVersion]);
|
}, [replayVersion]);
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { Button } from "antd";
|
import { Button } from "antd";
|
||||||
|
import { useCesium } from "resium";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
|
|
||||||
export default function ReplayButton() {
|
export default function ReplayButton() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { viewer } = useCesium();
|
||||||
|
|
||||||
const playHandler = useCallback(() => {
|
const playHandler = useCallback(() => {
|
||||||
|
if (!viewer.clock.shouldAnimate)
|
||||||
dispatch.data.update({ replayVersion: Date.now() });
|
dispatch.data.update({ replayVersion: Date.now() });
|
||||||
}, []);
|
}, [viewer]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.replayButton}>
|
<div className={styles.replayButton}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user