From 9671145bdaef363696ed38643b2aeb406a73165d Mon Sep 17 00:00:00 2001 From: cramerL Date: Thu, 27 Jun 2024 22:37:42 +0200 Subject: [PATCH] improved adding levels in map settings a bit, #255 --- CHANGELOG.md | 1 + .../map-content-settings.component.html | 35 ++++++++++++------- .../map-content-settings.component.ts | 20 ++++++++--- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81120f7d..44ff9c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Show exact match at first position in search [#296](https://github.com/CCDirectLink/crosscode-map-editor/issues/296) - Changed GlowingLine Step size from 16 to 8 [#276](https://github.com/CCDirectLink/crosscode-map-editor/issues/276) - Moving an Entity is now tracked in the history [#270](https://github.com/CCDirectLink/crosscode-map-editor/issues/270) +- Adding a new level in Map Settings guesses the correct level instead of using 0 [#255](https://github.com/CCDirectLink/crosscode-map-editor/issues/255) ## [1.5.0] 2024-03-20 ### Added diff --git a/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.html b/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.html index f4889ab0..a688ee68 100644 --- a/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.html +++ b/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.html @@ -5,14 +5,16 @@
- +
Map Size: width: - + height: - +

@@ -22,12 +24,20 @@ Levels:
- Level {{i}}: - - + Level {{ i }}: + +
- +
@@ -39,7 +49,7 @@
- {{i}} + {{ i }}
@@ -50,14 +60,15 @@
- cameraInBounds: + cameraInBounds: + [(ngModel)]="settings.attributes.cameraInBounds">
- +
- \ No newline at end of file + diff --git a/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.ts b/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.ts index d9c8a5d7..4573f713 100644 --- a/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.ts +++ b/webapp/src/app/components/dialogs/map-settings/map-content-settings/map-content-settings.component.ts @@ -19,8 +19,9 @@ export class MapContentSettingsComponent implements OnInit { }>(); mapSettings = mapSettingsjson.default; - constructor() { } - + constructor() { + } + ngOnInit() { if (this.settings.levels.length < 1) { @@ -53,12 +54,23 @@ export class MapContentSettingsComponent implements OnInit { // Parent won't update field if same value // force update value property numElement.value = value + ''; - + this.onSettingsChange.emit({ property, value }); } } - + + guessHeight(): number { + const levels = this.settings.levels; + if (levels.length === 0) { + return 0; + } + if (levels.length === 1) { + return levels[0].height + 16; + } + const [l1, l2] = levels.slice(-2); + return l2.height + (l2.height - l1.height); + } }