mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-08 03:18:36 +03:00
Fix bug caused by interrupting flyTo
This commit is contained in:
@@ -241,7 +241,7 @@ class Dashboard extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
renderIntroPopup(isMobile, styles) {
|
||||
renderIntroPopup(styles) {
|
||||
const checkMobile = isMobileOnly || window.innerWidth < 600;
|
||||
const { app, actions } = this.props;
|
||||
|
||||
@@ -266,7 +266,6 @@ class Dashboard extends React.Component {
|
||||
onClose={actions.toggleIntroPopup}
|
||||
content={app.intro}
|
||||
styles={styles}
|
||||
isMobile={false}
|
||||
>
|
||||
{extraContent}
|
||||
</Popup>
|
||||
@@ -299,32 +298,6 @@ class Dashboard extends React.Component {
|
||||
textAlign: "justify",
|
||||
};
|
||||
|
||||
// if (checkMobile) {
|
||||
// const msg =
|
||||
// "This platform is not suitable for mobile. Please re-visit the site on a device with a larger screen.";
|
||||
// return (
|
||||
// <div>
|
||||
// {features.USE_COVER && !app.intro && (
|
||||
// <StaticPage showing={app.flags.isCover}>
|
||||
// {/* enable USE_COVER in config.js features, and customise your header */}
|
||||
// {/* pass 'actions.toggleCover' as a prop to your custom header */}
|
||||
// <TemplateCover
|
||||
// showAppHandler={() => {
|
||||
// /* eslint-disable no-undef */
|
||||
// alert(msg);
|
||||
// /* eslint-enable no-undef */
|
||||
// }}
|
||||
// />
|
||||
// </StaticPage>
|
||||
// )}
|
||||
// {app.intro && <>{this.renderIntroPopup(true, popupStyles)}</>}
|
||||
// {!app.intro && !features.USE_COVER && (
|
||||
// <div className="fixedTooSmallMessage">{msg}</div>
|
||||
// )}
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
return (
|
||||
<div>
|
||||
{checkMobile ? null : (
|
||||
@@ -395,7 +368,7 @@ class Dashboard extends React.Component {
|
||||
isOpen={app.flags.isInfopopup}
|
||||
onClose={actions.toggleInfoPopup}
|
||||
/>
|
||||
{this.renderIntroPopup(false, popupStyles)}
|
||||
{this.renderIntroPopup(popupStyles)}
|
||||
{app.debug ? (
|
||||
<Notification
|
||||
isNotification={app.flags.isNotification}
|
||||
|
||||
@@ -141,11 +141,16 @@ class Map extends React.Component {
|
||||
map.zoomControl.remove();
|
||||
|
||||
map.on("moveend", () => {
|
||||
this.updateClusters();
|
||||
this.alignLayers();
|
||||
});
|
||||
|
||||
map.on("move zoomend viewreset", () => this.alignLayers());
|
||||
map.on("zoomend viewreset", () => {
|
||||
this.map.dragging.enable();
|
||||
this.map.doubleClickZoom.enable();
|
||||
this.map.scrollWheelZoom.enable();
|
||||
this.alignLayers();
|
||||
this.updateClusters();
|
||||
});
|
||||
map.on("zoomstart", () => {
|
||||
if (this.svgRef.current !== null)
|
||||
this.svgRef.current.classList.add("hide");
|
||||
@@ -287,6 +292,10 @@ class Map extends React.Component {
|
||||
expansionZoom + zoomLevelsToSkip,
|
||||
this.props.app.cluster.maxZoom
|
||||
);
|
||||
|
||||
this.map.dragging.disable();
|
||||
this.map.doubleClickZoom.disable();
|
||||
this.map.scrollWheelZoom.disable();
|
||||
this.map.flyTo(new L.LatLng(latitude, longitude), zoomToFly);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user