Skip to content

Commit

Permalink
fix: remove cycle anim and add message to tooltip to make button inte…
Browse files Browse the repository at this point in the history
…nt somewhat clearer
  • Loading branch information
Grammostola committed Mar 13, 2024
1 parent 4de56c9 commit 5a0a602
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
9 changes: 2 additions & 7 deletions scss/ui/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,8 @@ button.active,
}
}

.cycle-even {
.cycle {
background: linear-gradient(45deg, #8db2d7, #ddddee);
width: 37px;
height: 37px;
}
.cycle-odd {
background: linear-gradient(45deg, #ddddee, #8db2d7);
width: 37px;
height: 37px;
}
}
20 changes: 4 additions & 16 deletions src/controls/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,7 @@ const Legend = function Legend(options = {}) {

const styleName = theButton.data.activeLayer[0].get('styleName') || 'default';
const icon = viewer.getStyle(styleName) ? imageSource(viewer.getStyle(styleName)) : 'img/png/farg.png';
theButton.setIcon(icon, theButton.data.activeLayer[0].get('title'));
const element = document.getElementById(theButton.getId());

if (theButton.data.isEven) {
element.classList.remove('cycle-even');
element.classList.add('cycle-odd');
theButton.data.isEven = false;
} else {
element.classList.add('cycle-even');
element.classList.remove('cycle-odd');
theButton.data.isEven = true;
}
theButton.setIcon(icon, `Växla: ${theButton.data.activeLayer[0].get('title')}`);
};
Object.values(cycleGroups).forEach((cycleGroup) => {
let activeLayer = cycleGroup.find((layer) => layer.get('visible') === true);
Expand All @@ -118,14 +107,13 @@ const Legend = function Legend(options = {}) {
const title = activeLayer[0].get('title');
const cycleButton = Button({
icon,
title,
cls: 'round smallest border icon-small icon-bg cycle-even',
title: `Växla: ${title}`,
cls: 'round smallest border icon-small icon-bg cycle',
state: activeLayer[0].get('visible') ? 'active' : 'initial',
data: {
layers: cycleGroup,
activeLayer,
numberOfLayers: cycleGroup.length,
isEven: true
numberOfLayers: cycleGroup.length
},
methods: {
active: () => {
Expand Down

0 comments on commit 5a0a602

Please sign in to comment.