Mercurial > gemma
view client/src/application/Main.vue @ 888:2e2ac0b88af9
client: hide menu button and box for print
* Use bootstrap 4's class to hide the menu button and box from printing.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 01 Oct 2018 17:46:58 +0200 |
parents | 52fe3e20f750 |
children | 36731fbe51a2 |
line wrap: on
line source
<template> <div class="main d-flex flex-column"> <Maplayer :drawMode="drawMode" :split="isSplitscreen" :lat="6155376" :long="1819178" :zoom="11"></Maplayer> <div v-if="isSplitscreen" class="profile d-flex flex-row"> <FairwayProfile :minAlt="minAlt" maxAlt="maxAlt" :selectedWaterLevel="selectedWaterLevel" :fairwayCoordinates="fairwayCoordinates" :waterLevels="waterLevels" :data="currentProfile" :height="height" :width="width" :xScale="xAxis" :yScaleLeft="yAxisLeft" :yScaleRight="yAxisRight" :margin="margins" :totalLength="totalLength"></FairwayProfile> </div> </div> </template> <style lang="scss"> .profile { background-color: white; height: 50vh; } </style> <script> import Maplayer from "../map/Maplayer"; import FairwayProfile from "../fairway/Fairwayprofile"; import { mapGetters } from "vuex"; import debounce from "debounce"; export default { name: "mainview", components: { Maplayer, FairwayProfile }, data() { return { width: null, height: null, margin: { top: 20, right: 40, bottom: 20, left: 40 } }; }, computed: { ...mapGetters("application", ["isSplitscreen", "drawMode"]), ...mapGetters("fairwayprofile", [ "currentProfile", "minAlt", "maxAlt", "totalLength", "waterLevels", "fairwayCoordinates", "selectedWaterLevel" ]), xAxis() { return [this.xScale.x, this.xScale.y]; }, yAxisLeft() { const hi = Math.max(this.maxAlt, this.selectedWaterLevel); return [this.yScaleLeft.lo, hi]; }, yAxisRight() { const hi = Math.max(this.maxAlt, this.selectedWaterLevel) - this.selectedWaterLevel; const lo = this.selectedWaterLevel - this.minAlt; return [-lo, hi]; }, margins() { return this.margin; }, yScaleLeft() { return { lo: this.minAlt, hi: this.maxAlt }; }, xScale() { return { x: 0, y: this.totalLength }; } }, created() { window.addEventListener("resize", debounce(this.scaleFairwayProfile), 100); window.addEventListener("onbeforeprint", this.test); }, updated() { this.scaleFairwayProfile(); }, destroyed() { window.removeEventListener("resize", debounce(this.scaleFairwayProfile)); }, methods: { test(evt) { console.log("test: ", evt); }, scaleFairwayProfile() { if (!document.querySelector(".profile")) return; const clientHeight = document.querySelector(".profile").clientHeight; const clientWidth = document.querySelector(".profile").clientWidth; if (!clientHeight || !clientWidth) return; this.height = document.querySelector(".profile").clientHeight - 25; this.width = document.querySelector(".profile").clientWidth - 200; } } }; </script>