| ... | ... |
@@ -7,6 +7,38 @@ |
| 7 | 7 |
{% endblock %}
|
| 8 | 8 |
|
| 9 | 9 |
{% block main %}
|
| 10 |
+ <div class="tl_panel"> |
|
| 11 |
+ <div id="vr-daily-schedule-zoom" class="tl_submit_panel"> |
|
| 12 |
+ <button id="daily-zoom-in" class="tl_submit">+</button> |
|
| 13 |
+ <button id="daily-zoom-out" class="tl_submit">-</button> |
|
| 14 |
+ <button id="daily-zoom-reset" class="tl_submit" data-default="3">Reset</button> |
|
| 15 |
+ </div> |
|
| 16 |
+ <script> |
|
| 17 |
+ const zoomPanel = document.querySelector('#vr-daily-schedule-zoom');
|
|
| 18 |
+ const root = document.querySelector(':root');
|
|
| 19 |
+ const rootStyles = getComputedStyle(root); |
|
| 20 |
+ const defaultZoom = rootStyles.getPropertyValue('--slot-height');
|
|
| 21 |
+ |
|
| 22 |
+ zoomPanel.querySelectorAll('button').forEach((element) => {
|
|
| 23 |
+ element.addEventListener('click',() => {
|
|
| 24 |
+ let currentVal = rootStyles.getPropertyValue('--slot-height');
|
|
| 25 |
+ let split = currentVal.match(/^([-.\d]+(?:\.\d+)?)(.*)$/); |
|
| 26 |
+ [value,unit] = [parseFloat(split[1]),split[2] ? split[2] : '']; |
|
| 27 |
+ |
|
| 28 |
+ if (element.id == 'daily-zoom-in' && value < 9) |
|
| 29 |
+ {
|
|
| 30 |
+ root.style.setProperty('--slot-height',(value + 1.5) + unit);
|
|
| 31 |
+ } else if (element.id == 'daily-zoom-out' && value >= 3) |
|
| 32 |
+ {
|
|
| 33 |
+ root.style.setProperty('--slot-height',(value - 1.5) + unit);
|
|
| 34 |
+ } else if (element.id == 'daily-zoom-reset') |
|
| 35 |
+ {
|
|
| 36 |
+ root.style.setProperty('--slot-height',defaultZoom);
|
|
| 37 |
+ } |
|
| 38 |
+ }); |
|
| 39 |
+ }); |
|
| 40 |
+ </script> |
|
| 41 |
+ </div> |
|
| 10 | 42 |
<div class="vr-daily-schedule"> |
| 11 | 43 |
<div class="daily-timeline-container"> |
| 12 | 44 |
<div class="daily-timeline"> |
| ... | ... |
@@ -11,6 +11,10 @@ $header-bg-color: #f2f2f2; |
| 11 | 11 |
$slot-height: 3rem; |
| 12 | 12 |
$cell-amount: 48; |
| 13 | 13 |
|
| 14 |
+:root {
|
|
| 15 |
+ --slot-height: #{$slot-height};
|
|
| 16 |
+} |
|
| 17 |
+ |
|
| 14 | 18 |
.vr-daily-schedule {
|
| 15 | 19 |
position: relative; |
| 16 | 20 |
display: flex; |
| ... | ... |
@@ -35,7 +39,7 @@ $cell-amount: 48; |
| 35 | 39 |
} |
| 36 | 40 |
|
| 37 | 41 |
.daily-timeline-label-container {
|
| 38 |
- height: $slot-height; |
|
| 42 |
+ height: var(--slot-height); |
|
| 39 | 43 |
position: relative; |
| 40 | 44 |
padding-inline-end: 8px; |
| 41 | 45 |
text-align: right; |
| ... | ... |
@@ -72,7 +76,7 @@ $cell-amount: 48; |
| 72 | 76 |
vertical-align: top; |
| 73 | 77 |
|
| 74 | 78 |
.line {
|
| 75 |
- height: $slot-height; |
|
| 79 |
+ height: var(--slot-height); |
|
| 76 | 80 |
|
| 77 | 81 |
&:after {
|
| 78 | 82 |
content: ""; |
| ... | ... |
@@ -104,10 +108,10 @@ $cell-amount: 48; |
| 104 | 108 |
height: 100%; |
| 105 | 109 |
width: 100%; |
| 106 | 110 |
display: grid; |
| 107 |
- grid-template-rows: repeat($cell-amount, #{$slot-height / ($cell-amount / 24)});
|
|
| 111 |
+ grid-template-rows: repeat($cell-amount, calc(var(--slot-height) / (#{$cell-amount} / 24)));
|
|
| 108 | 112 |
|
| 109 | 113 |
.event-cell {
|
| 110 |
- line-height: $slot-height / 4; |
|
| 114 |
+ line-height: calc(var(--slot-height) / 4); |
|
| 111 | 115 |
z-index: 2; |
| 112 | 116 |
box-sizing: border-box; |
| 113 | 117 |
border-radius: 5px; |