Skip to content

Commit

Permalink
fix: Fixed deep copy of the analysis component binding function butto…
Browse files Browse the repository at this point in the history
…n parameter object
  • Loading branch information
flywin8 committed Feb 15, 2023
1 parent d4b8fa7 commit eb446c8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
8 changes: 4 additions & 4 deletions packages/components/analyses/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: zouyaoji@https://github.com/zouyaoji
* @Date: 2022-01-06 10:23:09
* @LastEditTime: 2023-02-15 16:19:01
* @LastEditTime: 2023-02-15 17:28:18
* @LastEditors: XIAOLIJUN
* @Description:
* @FilePath: \vue-cesium@next\packages\components\analyses\src\index.ts
Expand All @@ -18,7 +18,7 @@ import useDrawingFab from '@vue-cesium/composables/use-drawing/use-drawing-fab'
import VcAnalysisSightline from './sightline'
import VcAnalysisViewshed from './viewshed'
import { drawingEmit } from '@vue-cesium/utils/emits'
import { isEqual } from 'lodash-es'
import { cloneDeep, isEqual } from 'lodash-es'

const emits = {
...drawingEmit,
Expand All @@ -42,10 +42,10 @@ export default defineComponent({
const fabActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.fabActionOpts, props.fabActionOpts))

const sightlineActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.sightlineActionOpts, mergeActionOpts('sightlineActionOpts')))
const sightlineAnalysisOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.sightlineAnalysisOpts, props.sightlineAnalysisOpts))
const sightlineAnalysisOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.sightlineAnalysisOpts), props.sightlineAnalysisOpts))

const viewshedActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.viewshedActionOpts, mergeActionOpts('viewshedActionOpts')))
const viewshedAnalysisOpts = reactive<VcViewshedAnalysisOpts>(deepMerge(defaultOptions.viewshedAnalysisOpts, props.viewshedAnalysisOpts))
const viewshedAnalysisOpts = reactive<VcViewshedAnalysisOpts>(deepMerge(cloneDeep(defaultOptions.viewshedAnalysisOpts), props.viewshedAnalysisOpts))

options.sightlineActionOpts = sightlineActionOpts
options.sightlineAnalysisOpts = sightlineAnalysisOpts
Expand Down
16 changes: 8 additions & 8 deletions packages/components/drawings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import useDrawingFab from '@vue-cesium/composables/use-drawing/use-drawing-fab'
import { useLocale } from '@vue-cesium/composables'
import { drawingEmit } from '@vue-cesium/utils/emits'
import { VcDrawingsProps } from '..'
import { isEqual } from 'lodash-es'
import { cloneDeep, isEqual } from 'lodash-es'

const emits = {
...drawingEmit,
Expand All @@ -36,19 +36,19 @@ export default defineComponent({
const mainFabOpts = reactive<VcActionTooltipProps & VcFabProps>(Object.assign({}, defaultOptions.mainFabOpts, props.mainFabOpts))
const fabActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.fabActionOpts, props.fabActionOpts))
const pointActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.pointActionOpts, mergeActionOpts('pointActionOpts')))
const pointDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.pointDrawingOpts, props.pointDrawingOpts))
const pointDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.pointDrawingOpts), props.pointDrawingOpts))
const polylineActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.polylineActionOpts, mergeActionOpts('polylineActionOpts')))
const polylineDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.polylineDrawingOpts, props.polylineDrawingOpts))
const polylineDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.polylineDrawingOpts), props.polylineDrawingOpts))
const polygonActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.polygonActionOpts, mergeActionOpts('polygonActionOpts')))
const polygonDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.polygonDrawingOpts, props.polygonDrawingOpts))
const polygonDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.polygonDrawingOpts), props.polygonDrawingOpts))
const rectangleActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.rectangleActionOpts, mergeActionOpts('rectangleActionOpts')))
const rectangleDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.rectangleDrawingOpts, props.rectangleDrawingOpts))
const rectangleDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.rectangleDrawingOpts), props.rectangleDrawingOpts))
const circleActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.circleActionOpts, mergeActionOpts('circleActionOpts')))
const circleDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.circleDrawingOpts, props.circleDrawingOpts))
const circleDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.circleDrawingOpts), props.circleDrawingOpts))
const regularActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.regularActionOpts, mergeActionOpts('regularActionOpts')))
const regularDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.regularDrawingOpts, props.regularDrawingOpts))
const regularDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.regularDrawingOpts), props.regularDrawingOpts))
const pinActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.pinActionOpts, mergeActionOpts('pinActionOpts')))
const pinDrawingOpts = reactive<VcDrawingOpts>(deepMerge(defaultOptions.pinDrawingOpts, props.pinDrawingOpts))
const pinDrawingOpts = reactive<VcDrawingOpts>(deepMerge(cloneDeep(defaultOptions.pinDrawingOpts), props.pinDrawingOpts))

options.pointActionOpts = pointActionOpts
options.pointDrawingOpts = pointDrawingOpts
Expand Down
26 changes: 14 additions & 12 deletions packages/components/measurements/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type { VcActionTooltipProps, VcComponentInternalInstance, VcComponentPubl
import { useLocale } from '@vue-cesium/composables'
import useDrawingFab from '@vue-cesium/composables/use-drawing/use-drawing-fab'
import { drawingEmit } from '@vue-cesium/utils/emits'
import { isEqual } from 'lodash-es'
import { isEqual, cloneDeep } from 'lodash-es'

const emits = {
...drawingEmit,
Expand All @@ -49,63 +49,65 @@ export default defineComponent({
Object.assign({}, defaultOptions.distanceActionOpts, mergeActionOpts('distanceActionOpts'))
)
const distanceMeasurementOpts = reactive<VcMeasurementOpts>(
deepMerge(defaultOptions.distanceMeasurementOpts, props.distanceMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.distanceMeasurementOpts), props.distanceMeasurementOpts)
)

const componentDistanceActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.componentDistanceActionOpts, mergeActionOpts('componentDistanceActionOpts'))
)
const componentDistanceMeasurementOpts = reactive<VcComponentDistanceMeasurementOpts>(
deepMerge(defaultOptions.componentDistanceMeasurementOpts, props.componentDistanceMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.componentDistanceMeasurementOpts), props.componentDistanceMeasurementOpts)
)

const polylineActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.polylineActionOpts, mergeActionOpts('polylineActionOpts'))
)
const polylineMeasurementOpts = reactive<VcPolylineMeasurementOpts>(
deepMerge(defaultOptions.polylineMeasurementOpts, props.polylineMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.polylineMeasurementOpts), props.polylineMeasurementOpts)
)

const horizontalActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.horizontalActionOpts, mergeActionOpts('horizontalActionOpts'))
)
const horizontalMeasurementOpts = reactive<VcHorizontalMeasurementOpts>(
deepMerge(defaultOptions.horizontalMeasurementOpts, props.horizontalMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.horizontalMeasurementOpts), props.horizontalMeasurementOpts)
)

const verticalActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.verticalActionOpts, mergeActionOpts('verticalActionOpts'))
)
const verticalMeasurementOpts = reactive<VcMeasurementOpts>(
deepMerge(defaultOptions.verticalMeasurementOpts, props.verticalMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.verticalMeasurementOpts), props.verticalMeasurementOpts)
)

const heightActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.heightActionOpts, mergeActionOpts('heightActionOpts')))
const heightMeasurementOpts = reactive<VcMeasurementOpts>(deepMerge(defaultOptions.heightMeasurementOpts, props.heightMeasurementOpts))
const heightMeasurementOpts = reactive<VcMeasurementOpts>(deepMerge(cloneDeep(defaultOptions.heightMeasurementOpts), props.heightMeasurementOpts))

const areaActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.areaActionOpts, mergeActionOpts('areaActionOpts')))
const areaMeasurementOpts = reactive<VcPolylineMeasurementOpts>(deepMerge(defaultOptions.areaMeasurementOpts, props.areaMeasurementOpts))
const areaMeasurementOpts = reactive<VcPolylineMeasurementOpts>(
deepMerge(cloneDeep(defaultOptions.areaMeasurementOpts), props.areaMeasurementOpts)
)

const pointActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.pointActionOpts, mergeActionOpts('pointActionOpts')))
const pointMeasurementOpts = reactive<VcMeasurementOpts>(deepMerge(defaultOptions.pointMeasurementOpts, props.pointMeasurementOpts))
const pointMeasurementOpts = reactive<VcMeasurementOpts>(deepMerge(cloneDeep(defaultOptions.pointMeasurementOpts), props.pointMeasurementOpts))

const rectangleActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.rectangleActionOpts, mergeActionOpts('rectangleActionOpts'))
)
const rectangleMeasurementOpts = reactive<VcRegularMeasurementOpts>(
deepMerge(defaultOptions.rectangleMeasurementOpts, props.rectangleMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.rectangleMeasurementOpts), props.rectangleMeasurementOpts)
)

const regularActionOpts = reactive<VcActionTooltipProps>(
Object.assign({}, defaultOptions.regularActionOpts, mergeActionOpts('regularActionOpts'))
)
const regularMeasurementOpts = reactive<VcRegularMeasurementOpts>(
deepMerge(defaultOptions.regularMeasurementOpts, props.regularMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.regularMeasurementOpts), props.regularMeasurementOpts)
)

const circleActionOpts = reactive<VcActionTooltipProps>(Object.assign({}, defaultOptions.circleActionOpts, mergeActionOpts('circleActionOpts')))
const circleMeasurementOpts = reactive<VcRegularMeasurementOpts>(
deepMerge(defaultOptions.circleMeasurementOpts, props.circleMeasurementOpts)
deepMerge(cloneDeep(defaultOptions.circleMeasurementOpts), props.circleMeasurementOpts)
)

const options: any = {}
Expand Down

0 comments on commit eb446c8

Please sign in to comment.