annotate client/src/components/toolbar/Toolbar.vue @ 3044:c71373594719

client: map: prepared store to hold multiple map objects This will be necessary to sync maps, toggle layers per map, etc. Therefore the methods to move the map (moveToExtent, etc.) became actions instead of mutations.
author Markus Kottlaender <markus@intevation.de>
date Sat, 13 Apr 2019 16:02:06 +0200
parents 188fb0133e50
children 051a3f446ac2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
2534
bb5286acfee2 client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents: 2355
diff changeset
2 <div class="ml-1">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
3 <div
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
4 :class="
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
5 'rounded-top toolbar toolbar-' +
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
6 (expandToolbar ? 'expanded' : 'collapsed')
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
7 "
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
8 >
2940
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
9 <Identify />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
10 <Layers />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
11 <Profiles />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
12 <Gauges />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
13 <Linetool />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
14 <Polygontool />
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
15 <Pdftool />
3028
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
16 <PaneControl />
1436
59c9dbb26bb0 moved toolbar toggle button to bottom
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
17 </div>
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
18 <div
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
19 @click="$store.commit('application/expandToolbar', !expandToolbar)"
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
20 class="toolbar-button toolbar-toggle rounded-bottom bg-info text-white"
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
21 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
22 <font-awesome-icon
2154
a08e0f532304 staging: improve UI
Thomas Junk <thomas.junk@intevation.de>
parents: 1558
diff changeset
23 class="pointer"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
24 :icon="expandToolbar ? 'angle-up' : 'angle-down'"
2919
6c5364ff0abb client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
25 />
1436
59c9dbb26bb0 moved toolbar toggle button to bottom
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
26 </div>
1419
24b7f71c4406 made toolbar toggler a bit smaller and stay in one position
Markus Kottlaender <markus@intevation.de>
parents: 1414
diff changeset
27 </div>
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 </template>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
30 <style lang="scss">
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 // not scoped to affect nested components
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 // doen't work when put in application/assets/application.sass... why??? o_O
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
33 .toolbar {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
34 box-shadow: 0 0.1rem 0.5rem rgba(0, 0, 0, 0.2);
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
35 overflow: hidden;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
36 transition: max-height 0.4s;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
37 margin-bottom: auto;
2940
601797a85a86 client: toolbar: merged pointer class into toolbar-button class
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
38 cursor: pointer;
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
39 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
40
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
41 .toolbar-collapsed {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
42 max-height: 6rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
43 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
44
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
45 .toolbar-expanded {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
46 max-height: 100%;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
47 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
49 .toolbar-button {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
50 opacity: 0.96;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
51 color: #666;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
52 height: 2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
53 width: 2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
54 align-items: center;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
55 justify-content: center;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
56 display: flex;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
57 background: #fff;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
58 border-bottom: 1px solid #dee2e6;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
59 z-index: 2;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
60 pointer-events: auto;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
61 position: relative;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
62 overflow: hidden;
3028
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
63 &.disabled {
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
64 color: #ccc;
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
65 cursor: default;
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
66 }
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
67 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
68
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
69 .toolbar-button:last-child {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
70 border-bottom: none;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
71 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
72
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
73 .toolbar-button .inverted {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
74 color: #17a2b8;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
75 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
76
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
77 .toolbar-button .grey {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
78 color: #ddd;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
79 }
1419
24b7f71c4406 made toolbar toggler a bit smaller and stay in one position
Markus Kottlaender <markus@intevation.de>
parents: 1414
diff changeset
80
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
81 .toolbar-button .indicator {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
82 color: #fff;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
83 background: #17a2b8;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
84 position: absolute;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
85 bottom: -14px;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
86 left: -14px;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
87 padding: 2px 4px 1px;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
88 font-size: 11px;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
89 line-height: 11px;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
90 border-top-right-radius: 0.25rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
91 transition: bottom 0.3s, left 0.3s;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
92 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
93
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
94 .toolbar-button .indicator.show {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
95 left: 0;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
96 bottom: 0;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
97 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
98
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
99 .toolbar-toggle {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
100 height: 1.2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
101 border-bottom: none;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1436
diff changeset
102 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
103 </style>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
104
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
105 <script>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
106 /* This is Free Software under GNU Affero General Public License v >= 3.0
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
107 * without warranty, see README.md and license for details.
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
108 *
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
109 * SPDX-License-Identifier: AGPL-3.0-or-later
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
110 * License-Filename: LICENSES/AGPL-3.0.txt
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
111 *
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
112 * Copyright (C) 2018 by via donau
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
113 * – Österreichische Wasserstraßen-Gesellschaft mbH
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
114 * Software engineering by Intevation GmbH
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
115 *
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
116 * Author(s):
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
117 * Markus Kottländer <markus.kottlaender@intevation.de>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
118 */
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3028
diff changeset
119 import { mapState, mapGetters } from "vuex";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
120
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
121 export default {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
122 name: "toolbar",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
123 components: {
3028
188fb0133e50 client: panes: moved pane controls to toolbar
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
124 PaneControl: () => import("./PaneControl"),
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
125 Identify: () => import("./Identify"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
126 Layers: () => import("./Layers"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
127 Linetool: () => import("./Linetool"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
128 Polygontool: () => import("./Polygontool"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
129 Profiles: () => import("./Profiles"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
130 Gauges: () => import("./Gauges"),
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
131 Pdftool: () => import("./Pdftool")
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
132 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
133 computed: {
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3028
diff changeset
134 ...mapState("map", ["lineTool", "polygonTool", "cutTool"]),
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3028
diff changeset
135 ...mapState("application", ["expandToolbar", "panes"]),
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3028
diff changeset
136 ...mapGetters("map", ["openLayersMap"])
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
137 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 mounted() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
139 window.addEventListener("keydown", e => {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
140 // Escape
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
141 if (e.keyCode === 27) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
142 this.lineTool.setActive(false);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
143 this.polygonTool.setActive(false);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
144 this.cutTool.setActive(false);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
145 this.$store.commit("map/setCurrentMeasurement", null);
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1434
diff changeset
146 this.$store.dispatch("map/enableIdentifyTool");
3006
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2985
diff changeset
147 this.openLayersMap
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2985
diff changeset
148 .getLayer("DRAWTOOL")
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2985
diff changeset
149 .getSource()
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2985
diff changeset
150 .clear();
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
152 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
153 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
154 };
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
155 </script>