Bläddra i källkod

修改核心代码

bill 3 år sedan
förälder
incheckning
cbe0280367

+ 2 - 2
src/components/bill-ui/components/slide/index.vue

@@ -6,8 +6,8 @@
             </GateContent>
         </Gate>
         <template v-if="showCtrl">
-            <span class="left" @click="prevHandler"><UIIcon type="left" /></span>
-            <span class="right" @click="nextHandler"><UIIcon type="pull-more" /></span>
+            <span class="left" @click="prevHandler"><UIIcon type="left1" /></span>
+            <span class="right" @click="nextHandler"><UIIcon type="right" /></span>
         </template>
         <slot name="attach" :active="items[index]" />
 

+ 11 - 7
src/sdk/association.ts

@@ -13,9 +13,15 @@ import {
 
 import TaggingComponent from '@/components/tagging/list.vue'
 
-import type { SDK, SceneModel, SceneGuidePath } from '.'
+import type { SDK, SceneModel, SceneGuidePath, ModelAttrRange } from '.'
 import { Model, Tagging } from '@/store'
 
+export const modelRange: ModelAttrRange  = {
+  opacityRange: { min: 0, max: 1, step: 0.1 },
+  bottomRange: { min: -30, max: 70, step: 0.1 },
+  scaleRange: { min: 0, max: 2, step: 0.1 }
+}
+
 const sceneModelMap = new WeakMap<Model, SceneModel>()
 export const getSceneModel = (model: Model | null) => model && sceneModelMap.get(toRaw(model))
 
@@ -31,16 +37,14 @@ const associationModels = (sdk: SDK) => {
       const itemRaw = toRaw(item)
       const sceneModel = sdk.addModel({
         ...itemRaw,
+        ...modelRange,
         type: ModelType.SWMX,
         url: getResource(item.url)
       })
       sceneModelMap.set(itemRaw, sceneModel)
 
       sceneModel.bus.on('transformChanged', transform => {
-        Object.assign(item, {
-          ...transform,
-          scale: transform.scale ? transform.scale * 100 : item.scale
-        })
+        Object.assign(item, transform)
       })
       sceneModel.bus.on('changeSelect', select => {
         if (custom.currentModel === item && !select) {
@@ -76,8 +80,8 @@ const associationModels = (sdk: SDK) => {
           watchEffect(() => {
             getSceneModel(item)?.changeBottom(item.bottom)
           })
-          watchEffect(() => getSceneModel(item)?.changeOpacity(item.opacity / 100))
-          watchEffect(() => getSceneModel(item)?.changeScale(item.scale / 100))
+          watchEffect(() => getSceneModel(item)?.changeOpacity(item.opacity))
+          watchEffect(() => getSceneModel(item)?.changeScale(item.scale))
           watchEffect(() => getSceneModel(item)?.changeShow(modelShow.value))
           stopLoadedWatch()
         }

+ 1 - 1
src/sdk/cover/index.js

@@ -3,7 +3,7 @@ import mitt from 'mitt'
 import axios from 'axios' //{ axios } from '@/api'
 
 
-export const enter = (dom) => {
+export const enter = (dom, isLocal) => {
     
     Potree.settings.isOfficial = true //标记为正式、非测试版本 
     //Potree.fileServer = axios 

+ 11 - 2
src/sdk/sdk.ts

@@ -29,8 +29,17 @@ export type SceneModel = ToChangeAPI<Omit<SceneModelAttrs, 'position' | 'rotatio
     leaveTransform: () => void
   }
 
+export type ModelAttrRange = {
+  [key in 'opacity' | 'bottom' | 'scale' as `${key}Range`]: {
+    min: number,
+    max: number,
+    step: number
+  }
+}
 
-export type AddModelProps = Pick<Model, 'type' | 'url' | 'id'> & ModelAttrs
+export type AddModelProps = Pick<Model, 'type' | 'url' | 'id'> 
+  & ModelAttrs 
+  & ModelAttrRange
 
 export type SceneGuidePath = Pick<GuidePath, 'position' | 'target' | 'speed' | 'time'>
 export interface SceneGuide {
@@ -87,7 +96,7 @@ export const initialSDK = async (props: InialSDKProps) => {
   await Promise.all(libs.map(loadLib))
   await loadLib(`./lib/potree/potree.js`)
 
-  const localSdk = cover(props.layout) as unknown as SDK
+  const localSdk = cover(props.layout, true) as unknown as SDK
 
   sdk = localSdk
   sdk.layout = props.layout

+ 5 - 7
src/views/merge/index.vue

@@ -8,17 +8,17 @@
         <!-- <template #icon>
           <a href="">设置比例</a>
         </template> -->
-        <ui-input type="range" v-model="custom.currentModel.scale" v-bind="scaleOption" width="100%">
+        <ui-input type="range" v-model="custom.currentModel.scale" v-bind="modelRange.scaleRange" :ctrl="false" width="100%">
           <template #icon>%</template>
         </ui-input>
       </ui-group-option>
       <ui-group-option label="离地高度">
-        <ui-input type="range" v-model="custom.currentModel.bottom" v-bind="bottomOption" width="100%">
+        <ui-input type="range" v-model="custom.currentModel.bottom" v-bind="modelRange.bottomRange" :ctrl="false" width="100%">
           <template #icon>m</template>
         </ui-input>
       </ui-group-option>
       <ui-group-option label="模型不透明度">
-        <ui-input type="range" v-model="custom.currentModel.opacity" v-bind="opacityOption" width="100%">
+        <ui-input type="range" v-model="custom.currentModel.opacity" v-bind="modelRange.opacityRange" :ctrl="false" width="100%">
           <template #icon>%</template>
         </ui-input>
       </ui-group-option>
@@ -37,7 +37,7 @@ import { RightPano } from '@/layout'
 import { autoSaveModels, ModelAttrs } from '@/store'
 import { togetherCallback } from '@/utils'
 import Actions from '@/components/actions/index.vue'
-import { getSceneModel } from '@/sdk'
+import { getSceneModel, modelRange } from '@/sdk'
 import { useViewStack } from '@/hook'
 import { showLeftCtrlPanoStack, showLeftPanoStack, custom, modelsChangeStoreStack } from '@/env'
 import { ref, nextTick } from 'vue'
@@ -58,9 +58,7 @@ const defaultAttrs: ModelAttrs = {
   position: {x: 0, y: 0, z: 0},
   rotation: {x: 0, y: 0, z: 0}
 }
-const opacityOption = { min: 0, max: 100, step: 1, ctrl: false }
-const bottomOption = { min: -30, max: 70, step: 0.1, ctrl: false }
-const scaleOption = { min: 0, max: 200, step: 1, ctrl: false }
+
 const actionItems: ActionsProps['items'] = [
   {
     icon: 'move',

+ 2 - 0
src/views/tagging/index.vue

@@ -93,6 +93,8 @@ const saveHandler = (tagging: Tagging) => {
 
 const deleteTagging = (tagging: Tagging) => {
   const index = taggings.value.indexOf(tagging)
+  const positions = getTaggingPositions(tagging)
+  taggingPositions.value = taggingPositions.value.filter(position => !positions.includes(position))
   taggings.value.splice(index, 1)
 }