casc-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 2.91 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../packages/composables/use-primitive-collection-items/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-07 23:36:43\n * @LastEditTime: 2021-11-20 16:06:29\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\composables\\use-primitive-collection-items\\index.ts\n */\n/**\n * for\n * Billboard\n * Label\n * PointPrimitive\n * Polyline\n */\n\nimport { VcComponentInternalInstance } from 'casc-cesium-utils/types'\nimport useCommon from '../use-common'\n\nexport type CollectionItem = Cesium.Billboard | Cesium.Label | Cesium.PointPrimitive | Cesium.Polyline\n\nexport default function (props, ctx, vcInstance: VcComponentInternalInstance) {\n // state\n const commonState = useCommon(props, ctx, vcInstance)\n if (commonState === void 0) {\n return\n }\n // methods\n vcInstance.createCesiumObject = async () => {\n const options = commonState.transformProps(props)\n const primitives = commonState.$services.primitives\n return primitives && primitives.add(options)\n }\n\n vcInstance.mount = async () => {\n const primitives = commonState.$services.primitives\n const collectionItem = vcInstance.cesiumObject as CollectionItem\n return primitives && primitives.contains(collectionItem)\n }\n vcInstance.unmount = async () => {\n const primitives = commonState.$services.primitives\n const collectionItem = vcInstance.cesiumObject as CollectionItem\n return primitives && !primitives.isDestroyed() && primitives.remove(collectionItem)\n }\n\n return {\n transformProps: commonState.transformProps,\n unwatchFns: commonState.unwatchFns,\n setPropsWatcher: commonState.setPropsWatcher,\n $services: commonState.$services\n }\n}\n"],"names":[],"mappings":";;AACe,oCAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE;AAChD,EAAE,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;AACxD,EAAE,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE;AAC9B,IAAI,OAAO;AACX,GAAG;AACH,EAAE,UA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