Skip to content

Commit a1ce543

Browse files
committed
Port TaskButton to MapButton
1 parent a3b2f4c commit a1ce543

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qwc2",
3-
"version": "2025.05.26",
3+
"version": "2025.05.27",
44
"description": "QGIS Web Client",
55
"author": "Sourcepole AG",
66
"license": "BSD-2-Clause",

plugins/TaskButton.jsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import React from 'react';
1010
import {connect} from 'react-redux';
1111

12-
import classnames from 'classnames';
1312
import PropTypes from 'prop-types';
1413

1514
import {setCurrentTask} from '../actions/task';
16-
import Icon from '../components/Icon';
15+
import MapButton from '../components/MapButton';
1716
import ConfigUtils from '../utils/ConfigUtils';
1817
import LocaleUtils from "../utils/LocaleUtils";
1918
import ThemeUtils from '../utils/ThemeUtils';
@@ -26,7 +25,6 @@ class TaskButton extends React.Component {
2625
currentTask: PropTypes.string,
2726
/** The icon name. */
2827
icon: PropTypes.string,
29-
mapMargins: PropTypes.object,
3028
/** The task mode. */
3129
mode: PropTypes.string,
3230
/** The position slot index of the map button, from the bottom (0: bottom slot). */
@@ -47,22 +45,10 @@ class TaskButton extends React.Component {
4745
if (!ThemeUtils.themeFlagsAllowed(this.props.theme, this.props.themeFlagWhitelist, this.props.themeFlagBlacklist)) {
4846
return null;
4947
}
50-
const right = this.props.mapMargins.right;
51-
const bottom = this.props.mapMargins.bottom;
52-
const style = {
53-
right: 'calc(1.5em + ' + right + 'px)',
54-
bottom: 'calc(var(--bottombar-height) + ' + bottom + 'px + ' + (3 + 4 * this.props.position) + 'em)'
55-
};
56-
const classes = classnames({
57-
"map-button": true,
58-
"map-button-active": this.props.currentTask === this.props.task
59-
});
6048
const title = LocaleUtils.tr("appmenu.items." + this.props.task + (this.props.mode || ""));
6149
return (
62-
<button className={classes} onClick={this.buttonClicked}
63-
style={style} title={title}>
64-
<Icon icon={this.props.icon} />
65-
</button>
50+
<MapButton icon={this.props.icon} onClick={this.buttonClicked}
51+
position={this.props.position} tooltip={title} />
6652
);
6753
}
6854
buttonClicked = () => {
@@ -73,7 +59,6 @@ class TaskButton extends React.Component {
7359

7460
const selector = (state) => ({
7561
currentTask: state.task.id,
76-
mapMargins: state.windows.mapMargins,
7762
theme: state.theme.current
7863
});
7964

0 commit comments

Comments
 (0)