From 79fb70d7699de1af82ae291555e4ae3b514fd9e1 Mon Sep 17 00:00:00 2001 From: Moritz Kirmse Date: Mon, 28 Oct 2024 14:55:46 +0100 Subject: [PATCH] apply review comments --- .../draw/feature-edit-style-point.vue | 2 +- src/components/draw/feature-edit-style.vue | 17 ++++++++--------- src/components/draw/feature-item.vue | 5 +---- src/components/draw/feature-sub-content.vue | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/components/draw/feature-edit-style-point.vue b/src/components/draw/feature-edit-style-point.vue index a31ec874..44943bf2 100644 --- a/src/components/draw/feature-edit-style-point.vue +++ b/src/components/draw/feature-edit-style-point.vue @@ -18,6 +18,6 @@ const popupOpen: Ref = inject('popupOpen')! - + diff --git a/src/components/draw/feature-edit-style.vue b/src/components/draw/feature-edit-style.vue index 3f3ddfcc..71b4af37 100644 --- a/src/components/draw/feature-edit-style.vue +++ b/src/components/draw/feature-edit-style.vue @@ -36,24 +36,23 @@ function onColorSelect(colorEvent: Event) { feature.changed() } -function onSizeChange(newSize: string | number) { - feature.featureStyle.size = parseFloat(newSize as string) +function onSizeChange(newSize: number) { + feature.featureStyle.size = newSize feature.changed() } -function onAngleChange(newAngle: string | number) { - feature.featureStyle.angle = (parseFloat(newAngle as string) * Math.PI) / 180 +function onAngleChange(newAngle: number) { + feature.featureStyle.angle = (newAngle * Math.PI) / 180 feature.changed() } -function onWidthChange(newWidth: string | number) { - feature.featureStyle.stroke = parseFloat(newWidth as string) +function onWidthChange(newWidth: number) { + feature.featureStyle.stroke = newWidth feature.changed() } -function onTransparencyChange(newTransparency: string | number) { - feature.featureStyle.opacity = - (100 - parseFloat(newTransparency as string)) / 100 +function onTransparencyChange(newTransparency: number) { + feature.featureStyle.opacity = (100 - newTransparency) / 100 feature.changed() } diff --git a/src/components/draw/feature-item.vue b/src/components/draw/feature-item.vue index 98db1a7a..d4011e43 100644 --- a/src/components/draw/feature-item.vue +++ b/src/components/draw/feature-item.vue @@ -22,7 +22,6 @@ const props = withDefaults( } ) -// should preform deep copy, nut then the updqte of the OL object on the canvas would not work ?? const localFeature = props.feature const emit = defineEmits([ @@ -51,13 +50,11 @@ function onClickDelete() { function onResetInfo(prevLabel: string, prevDescription: string) { localFeature.label = prevLabel localFeature.description = prevDescription - // emit('submitFeature', localFeature) } function onResetStyle(prevStyle: DrawnFeatureStyle) { - localFeature.featureStyle = Object.assign({}, prevStyle) + localFeature.featureStyle = { ...prevStyle } localFeature.changed() - // emit('submitFeature', localFeature) } function onSubmitEditFeature() { diff --git a/src/components/draw/feature-sub-content.vue b/src/components/draw/feature-sub-content.vue index 193bbe67..ee131c7f 100644 --- a/src/components/draw/feature-sub-content.vue +++ b/src/components/draw/feature-sub-content.vue @@ -29,7 +29,7 @@ const feature: DrawnFeature = inject('feature')! let prevLabel = feature.label let prevDescription = feature.description // keep deep copy of previous style to be able to revert style on cancel -const prevStyle: DrawnFeatureStyle = Object.assign({}, feature.featureStyle) +const prevStyle: DrawnFeatureStyle = { ...feature.featureStyle } const editComponents = { FeatureConcentricCircle,