Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/3348/deselect building reset color #3426

Merged
merged 8 commits into from Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/pull_request_template.md
Expand Up @@ -13,11 +13,11 @@ _**Please read the [CONTRIBUTING.md](https://github.com/MaibornWolff/codecharta/
## Definition of Done

A PR is only ready for merge once all the following acceptance criteria are fulfilled:
-[ ] Changes have been manually tested
-[ ] All TODOs related to this PR have been closed
-[ ] There are automated tests for newly written code and bug fixes
-[ ] All bugs discovered while working on this PR have been submitted as issues (if not already an open issue)
-[ ] Documentation (GH-pages, analysis/visualisation READMEs, parser READMEs, --help, etc.) has been updated (almost always necessary except for bug fixes)
-[ ] CHANGELOG.md has been updated
- [ ] Changes have been manually tested
- [ ] All TODOs related to this PR have been closed
- [ ] There are automated tests for newly written code and bug fixes
- [ ] All bugs discovered while working on this PR have been submitted as issues (if not already an open issue)
- [ ] Documentation (GH-pages, analysis/visualization READMEs, parser READMEs, --help, etc.) has been updated (almost always necessary except for bug fixes)
- [ ] CHANGELOG.md has been updated

## Screenshots or gifs
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
- Fix the csv-exporter so that it exports multiple projects instead of just one when multiple projects are specified [#3414](https://github.com/MaibornWolff/codecharta/pull/3414)
- Fix file extensions of output files for merged projects [#3421](https://github.com/MaibornWolff/codecharta/pull/3421)
- Fix the ability for users to accidentally pass invalid metrics to the RawTextParser without it crashing [#3424](https://github.com/MaibornWolff/codecharta/pull/3424)
- Fix deselected buildings with green/red roof in delta mode do not reset their color roof [#3426](https://github.com/MaibornWolff/codecharta/pull/3426)

### Chore ‍👨‍💻 👩‍💻

Expand Down
Expand Up @@ -149,7 +149,7 @@ CodeMapBuilding {
},
"_color": "#EB8319",
"_defaultColor": "#ddcc00",
"_defaultDeltaColor": "#EB8319",
"_defaultDeltaColor": "#000000",
"_deltaColor": "#EB8319",
"_id": 1,
"_node": {
Expand Down
Expand Up @@ -31,27 +31,24 @@ export class CodeMapBuilding {
}

decreaseLightness(value: number) {
const defaultColorHSL = ColorConverter.hexToHSL(this._defaultColor)
defaultColorHSL.decreaseLightness(value)
if (defaultColorHSL.getLightness() < 10) {
defaultColorHSL.setLightness(10)
} else {
defaultColorHSL.setLightness(defaultColorHSL.getLightness())
}
this._color = defaultColorHSL.toHex()
this._color = this._decreaseLightnessForColor(this._defaultColor, value)

if (this._node.deltas) {
const deltaColorHSL = ColorConverter.hexToHSL(this._defaultDeltaColor)
deltaColorHSL.decreaseLightness(value)
if (deltaColorHSL.getLightness() < 10) {
deltaColorHSL.setLightness(10)
} else {
deltaColorHSL.setLightness(deltaColorHSL.getLightness())
}
this._deltaColor = deltaColorHSL.toHex()
this._deltaColor = this._decreaseLightnessForColor(this._defaultDeltaColor, value)
}
}

_decreaseLightnessForColor(color: string, value: number) {
const colorHSL = ColorConverter.hexToHSL(color)
colorHSL.decreaseLightness(value)
if (colorHSL.getLightness() < 10) {
colorHSL.setLightness(10)
} else {
colorHSL.setLightness(colorHSL.getLightness())
}
return colorHSL.toHex()
}

getColorVector() {
return ColorConverter.getVector3(this._color)
}
Expand Down Expand Up @@ -113,4 +110,8 @@ export class CodeMapBuilding {
this._defaultDeltaColor = color
this._deltaColor = color
}

setOnclickDeltaColor(color: string) {
phanlezz marked this conversation as resolved.
Show resolved Hide resolved
this._deltaColor = color
}
}
Expand Up @@ -47,8 +47,8 @@ export class CodeMapMesh {

selectBuilding(building: CodeMapBuilding, color: string) {
building.setColor(color)
building.setDeltaColor(color)
this.setVertexColor(building.id, building.getColorVector(), building.getDefaultDeltaColorVector())
building.setOnclickDeltaColor(color)
this.setVertexColor(building.id, building.getColorVector(), building.getDeltaColorVector())
this.updateVertices()
}

Expand Down