Added export animation
+Added svg export animation *Moved Constants.originalPublicBuildUrl to Constants.svgExport.originalPublicBuildUrl
This commit is contained in:
parent
6f44d148ed
commit
9d2fef5e73
@ -6,6 +6,22 @@
|
|||||||
background-color: var(--map-background-color);
|
background-color: var(--map-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.map.export-border::after {
|
||||||
|
border: 5px solid var(--map-text-color);
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
width: -moz-available;
|
||||||
|
width: -webkit-fill-available;
|
||||||
|
width: stretch;
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
height: -moz-available;
|
||||||
|
height: -webkit-fill-available;
|
||||||
|
height: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
.export-container {
|
.export-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@ -1,14 +1,27 @@
|
|||||||
import { useContext } from "react";
|
import { useCallback, useContext } from "react";
|
||||||
import SceneryContext from "../../contexts/SceneryContext";
|
import SceneryContext from "../../contexts/SceneryContext";
|
||||||
|
import SideMenuContext from "../../contexts/SideMenuContext";
|
||||||
import ExportHelper from "../../helpers/exportHelper";
|
import ExportHelper from "../../helpers/exportHelper";
|
||||||
|
import Constants from "../../helpers/constants";
|
||||||
|
|
||||||
export default function ExportViewButton() {
|
export default function ExportViewButton() {
|
||||||
const { scenery } = useContext(SceneryContext);
|
const { scenery } = useContext(SceneryContext);
|
||||||
|
const { setSideMenuOpen } = useContext(SideMenuContext);
|
||||||
|
|
||||||
|
const onButtonClick = useCallback(async () => {
|
||||||
|
const mapElement = document.querySelector('.map');
|
||||||
|
|
||||||
|
setSideMenuOpen(false);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, Constants.svgExport.hidePanelDuration));
|
||||||
|
mapElement.classList.add('export-border');
|
||||||
|
await new Promise(resolve => setTimeout(resolve, Constants.svgExport.borderDuration));
|
||||||
|
mapElement.classList.remove('export-border');
|
||||||
|
|
||||||
const onButtonClick = () => {
|
|
||||||
const filename = (scenery.getName() || 'export') + '.svg';
|
const filename = (scenery.getName() || 'export') + '.svg';
|
||||||
ExportHelper.exportSvg(filename);
|
ExportHelper.exportSvg(filename);
|
||||||
};
|
|
||||||
|
setSideMenuOpen(true);
|
||||||
|
}, [scenery, setSideMenuOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="export-view-button">
|
<div className="export-view-button">
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
const Constants = {
|
const Constants = {
|
||||||
buildVersion: '1.6.2',
|
buildVersion: '1.6.2',
|
||||||
originalPublicBuildUrl: 'https://maseuko.pl/soft/td2-visualizer-2/', // do NOT change
|
|
||||||
map: {
|
map: {
|
||||||
zoomSensitivity: 0.002,
|
zoomSensitivity: 0.002,
|
||||||
zoomMin: 0.03,
|
zoomMin: 0.03,
|
||||||
@ -31,6 +30,11 @@ const Constants = {
|
|||||||
skipPlatforms: false,
|
skipPlatforms: false,
|
||||||
resolveElectrificationStepMode: false,
|
resolveElectrificationStepMode: false,
|
||||||
},
|
},
|
||||||
|
svgExport: {
|
||||||
|
hidePanelDuration: 500,
|
||||||
|
borderDuration: 100,
|
||||||
|
originalPublicBuildUrl: 'https://maseuko.pl/soft/td2-visualizer-2/', // do NOT change
|
||||||
|
},
|
||||||
warnings: {
|
warnings: {
|
||||||
all: false, // enable all warnings
|
all: false, // enable all warnings
|
||||||
trackObjectCannotBeApplied: false,
|
trackObjectCannotBeApplied: false,
|
||||||
|
|||||||
@ -116,7 +116,7 @@ function addMetadata(svg) {
|
|||||||
const description = document.createElementNS('http://purl.org/dc/elements/1.1/', 'dc:description');
|
const description = document.createElementNS('http://purl.org/dc/elements/1.1/', 'dc:description');
|
||||||
description.textContent = `Exported using TD2 Visualizer v${Constants.buildVersion}`;
|
description.textContent = `Exported using TD2 Visualizer v${Constants.buildVersion}`;
|
||||||
const source = document.createElementNS('http://purl.org/dc/elements/1.1/', 'dc:source');
|
const source = document.createElementNS('http://purl.org/dc/elements/1.1/', 'dc:source');
|
||||||
source.textContent = Constants.originalPublicBuildUrl;
|
source.textContent = Constants.svgExport.originalPublicBuildUrl;
|
||||||
|
|
||||||
rdf.appendChild(description);
|
rdf.appendChild(description);
|
||||||
rdf.appendChild(source);
|
rdf.appendChild(source);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user