comparison client/src/lib/mixins.js @ 3180:429e28295902

available_fairway_depth: implement reactivity
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 07 May 2019 14:06:23 +0200
parents b6c10b30d6bd
children 0c5a28ffe9ee
comparison
equal deleted inserted replaced
3179:6ddd3755350c 3180:429e28295902
10 * 10 *
11 * Author(s): 11 * Author(s):
12 * Markus Kottländer <markus.kottlaender@intevation.de> 12 * Markus Kottländer <markus.kottlaender@intevation.de>
13 */ 13 */
14 import locale2 from "locale2"; 14 import locale2 from "locale2";
15 const sortTable = { 15 export const sortTable = {
16 data() { 16 data() {
17 return { 17 return {
18 sortColumn: "", 18 sortColumn: "",
19 sortDirection: "ASC", 19 sortDirection: "ASC",
20 pageSize: 20, 20 pageSize: 20,
27 this.sortDirection = sorting.sortDirection; 27 this.sortDirection = sorting.sortDirection;
28 } 28 }
29 } 29 }
30 }; 30 };
31 31
32 const pane = { 32 export const diagram = {
33 methods: {
34 getDimensions() {
35 //dimensions and margins
36 const svgWidth = document.querySelector("#" + this.containerId)
37 .clientWidth;
38 const svgHeight = document.querySelector("#" + this.containerId)
39 .clientHeight;
40 const mainMargin = { top: 20, right: 20, bottom: 110, left: 80 };
41 const navMargin = {
42 top: svgHeight - mainMargin.top - 65,
43 right: 20,
44 bottom: 30,
45 left: 80
46 };
47 const width = +svgWidth - mainMargin.left - mainMargin.right;
48 const mainHeight = +svgHeight - mainMargin.top - mainMargin.bottom;
49 const navHeight = +svgHeight - navMargin.top - navMargin.bottom;
50 return { width, mainHeight, navHeight, mainMargin, navMargin };
51 }
52 }
53 };
54
55 export const pane = {
33 computed: { 56 computed: {
34 paneId() { 57 paneId() {
35 return this.$parent.pane.id; 58 return this.$parent.pane.id;
36 } 59 }
37 } 60 }
38 }; 61 };
39 62
40 const pdfgen = { 63 export const pdfgen = {
41 methods: { 64 methods: {
42 addText(position, offset, width, fontSize, color, text) { 65 addText(position, offset, width, fontSize, color, text) {
43 text = this.replacePlaceholders(text); 66 text = this.replacePlaceholders(text);
44 // split the incoming string to an array, each element is a string of 67 // split the incoming string to an array, each element is a string of
45 // words in a single line 68 // words in a single line
169 text 192 text
170 ); 193 );
171 } 194 }
172 } 195 }
173 }; 196 };
174
175 export { sortTable, pane, pdfgen };