Add A2 poster, fix pointer events, add templates to build output

This commit is contained in:
Pieter Vander Vennet 2022-09-20 12:50:36 +02:00
parent d50fd663ef
commit aaa7439b02
4 changed files with 2364 additions and 6 deletions

View file

@ -13,7 +13,6 @@ import {Utils} from "../Utils";
import Locale from "../UI/i18n/Locale";
import Constants from "../Models/Constants";
import Hash from "../Logic/Web/Hash";
import {QueryParameters} from "../Logic/Web/QueryParameters";
class SvgToPdfInternals {
private readonly doc: jsPDF;
@ -790,7 +789,7 @@ export class SvgToPdfPage {
}
public drawPage(advancedApi: jsPDF, i: number, language: string): void {
public drawPage(advancedApi: jsPDF, i: number): void {
if (!this._isPrepared) {
throw "Run 'Prepare()' first!"
}
@ -810,7 +809,8 @@ export class SvgToPdf {
public static readonly templates : Record<string, {pages: string[], description: string | Translation}>= {
flyer_a4:{pages: ["/assets/templates/MapComplete-flyer.svg","/assets/templates/MapComplete-flyer.back.svg"], description: Translations.t.flyer.description},
poster_a3: {pages: ["/assets/templates/MapComplete-poster-a3.svg"], description: "A basic A3 poster (similar to the flyer)"}
poster_a3: {pages: ["/assets/templates/MapComplete-poster-a3.svg"], description: "A basic A3 poster (similar to the flyer)"},
poster_a2: {pages: ["/assets/templates/MapComplete-poster-a2.svg"], description: "A basic A2 poster (similar to the flyer); scaled up from the A3 poster"}
}
private readonly _title: string;
@ -856,7 +856,7 @@ export class SvgToPdf {
const sy = mediabox.topRightY / targetHeight
advancedApi.setCurrentTransformationMatrix(advancedApi.Matrix(sx, 0, 0, -sy, 0, mediabox.topRightY))
}
this._pages[i].drawPage(advancedApi, i, language)
this._pages[i].drawPage(advancedApi, i)
}
})
await doc.save(this._title+"."+language+".pdf");

View file

@ -1,4 +1,6 @@
import { Utils } from "./Utils"
import MinimapImplementation from "./UI/Base/MinimapImplementation";
7import { Utils } from "./Utils"
import AllThemesGui from "./UI/AllThemesGui"
import { QueryParameters } from "./Logic/Web/QueryParameters"
import StatisticsGUI from "./UI/StatisticsGUI"
@ -44,10 +46,11 @@ if (mode.data === "statistics") {
new FixedUiElement("").AttachTo("centermessage")
new StatisticsGUI().SetClass("w-full h-full pointer-events-auto").AttachTo("topleft-tools")
} else if(mode.data === "pdf"){
MinimapImplementation.initialize()
new FixedUiElement("").AttachTo("centermessage")
const div = document.createElement("div")
div.id = "extra_div_for_maps"
new PdfExportGui(div.id).AttachTo("topleft-tools")
new PdfExportGui(div.id).SetClass("pointer-event-auto").AttachTo("topleft-tools")
document.getElementById("topleft-tools").appendChild(div)
} else {
new AllThemesGui().setup()

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

@ -25,10 +25,12 @@ fi
cp -r assets/layers/ dist/assets/layers/
cp -r assets/themes/ dist/assets/themes/
cp -r assets/svg/ dist/assets/svg/
cp -r assets/templates/ dist/assets/templates/
cp -r assets/tagRenderings/ dist/assets/tagRenderings/
cp assets/*.png dist/assets/
cp assets/*.svg dist/assets/
SRC_MAPS="--no-source-maps"
BRANCH=`git rev-parse --abbrev-ref HEAD`
echo "The branch name is $BRANCH"