fuchengshen
2022-07-09 3a25c05b5ab837714f30469cdcb1e2a77d8d7f6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
  <mars-pannel :visible="true" right="10" top="10" width="360">
    <div class="f-mb">
      <a-space>
        <a-checkbox @change="onChangeSnowState" v-model:checked="formState.enabledSnow">下雪效果:</a-checkbox>
        <span>下雪速度</span>
        <mars-slider @change="onChangeSpeed" v-model:value="formState.speed" :min="1" :max="100" />
      </a-space>
    </div>
 
    <div>
      <a-space>
        <a-checkbox @change="onChangeCoverState" v-model:checked="formState.enabledCover">积雪效果:</a-checkbox>
        <span>积雪程度</span>
        <mars-slider @change="onChangeAlpha" v-model:value="formState.alpha" :min="0" :max="1" :step="0.1" />
      </a-space>
    </div>
  </mars-pannel>
</template>
 
<script setup lang="ts">
import { reactive } from "vue"
import * as mapWork from "./map.js"
 
const formState = reactive({
  enabledSnow: true,
  enabledCover: true,
  speed: 20,
  alpha: 0.6
})
 
// 下雪速度
const onChangeSpeed = () => {
  mapWork.setSpeed(formState.speed)
}
 
// 积雪厚度
const onChangeAlpha = () => {
  mapWork.setAlpha(formState.alpha)
}
 
// 是否开启下雪效果
const onChangeSnowState = () => {
  mapWork.setSnow(formState.enabledSnow)
}
 
// 是否开启积雪效果
const onChangeCoverState = () => {
  mapWork.setCover(formState.enabledCover)
}
</script>
<style scoped lang="less">
.ant-slider {
  width: 146px;
}
</style>