Mercurial > gemma
comparison client/src/lib/mixins.js @ 4138:33deb8634783 improvepdf
mixin: set relative defaults for margins
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 01 Aug 2019 11:57:36 +0200 |
parents | a6eda41e7724 |
children | 552ea22ed266 |
comparison
equal
deleted
inserted
replaced
4137:a41fd26c1644 | 4138:33deb8634783 |
---|---|
50 | 50 |
51 export const diagram = { | 51 export const diagram = { |
52 methods: { | 52 methods: { |
53 getDimensions({ svgWidth, svgHeight, main, nav }) { | 53 getDimensions({ svgWidth, svgHeight, main, nav }) { |
54 const mainMargin = main || { | 54 const mainMargin = main || { |
55 top: 20, | 55 top: Math.floor(0.08 * svgHeight), |
56 right: 80, | 56 right: Math.floor(0.08 * svgWidth), |
57 bottom: 60, | 57 bottom: Math.floor(0.2 * svgHeight), |
58 left: 80 | 58 left: Math.floor(0.08 * svgWidth) |
59 }; | 59 }; |
60 const navMargin = nav || { | 60 const navMargin = nav || { |
61 top: svgHeight - mainMargin.top - 65, | 61 top: Math.floor(0.78 * svgHeight), |
62 right: 20, | 62 right: Math.floor(0.013 * svgWidth), |
63 bottom: 30, | 63 bottom: Math.floor(0.095 * svgHeight), |
64 left: 80 | 64 left: Math.floor(0.07 * svgWidth) |
65 }; | 65 }; |
66 const width = Number(svgWidth) - mainMargin.left - mainMargin.right; | 66 const width = Number(svgWidth) - mainMargin.left - mainMargin.right; |
67 const mainHeight = Number(svgHeight) - mainMargin.top - mainMargin.bottom; | 67 const mainHeight = Number(svgHeight) - mainMargin.top - mainMargin.bottom; |
68 const navHeight = Number(svgHeight) - navMargin.top - navMargin.bottom; | 68 const navHeight = Number(svgHeight) - navMargin.top - navMargin.bottom; |
69 return { width, mainHeight, navHeight, mainMargin, navMargin }; | 69 return { width, mainHeight, navHeight, mainMargin, navMargin }; |