{"version":3,"file":"index.mjs","sources":["../../../../../packages/composables/use-graphics/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-06-01 18:06:23\n * @LastEditTime: 2022-01-14 16:27:10\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\composables\\use-graphics\\index.ts\n */\nimport type { EntityEmitType, VcComponentInternalInstance, VcComponentPublicInstance, VcGraphics } from '@vue-cesium/utils/types'\nimport useCommon from '../use-common'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { getVcParentInstance } from '@vue-cesium/utils/private/vm'\n\nexport default function (props, ctx, vcInstance: VcComponentInternalInstance) {\n  // state\n  vcInstance.cesiumEvents = ['definitionChanged']\n  const commonState = useCommon(props, ctx, vcInstance)\n\n  if (commonState === void 0) {\n    return\n  }\n  // methods\n  vcInstance.mount = async () => {\n    const graphics = vcInstance.cesiumObject as VcGraphics\n\n    if (graphics === undefined) {\n      return false\n    }\n\n    const cmpNameArr = kebabCase(vcInstance.proxy?.$options.name || '').split('-')\n    const emitType = (cmpNameArr.length === 3 ? `update:${cmpNameArr[2]}` : 'update:polylineVolume') as EntityEmitType\n    const parentVM = getVcParentInstance(vcInstance).proxy as VcComponentPublicInstance\n    return parentVM && parentVM.__updateGraphics?.(graphics, emitType)\n  }\n  vcInstance.unmount = async () => {\n    const cmpNameArr = kebabCase(vcInstance.proxy?.$options.name || '').split('-')\n    const emitType = (cmpNameArr.length === 3 ? `update:${cmpNameArr[2]}` : 'update:polylineVolume') as EntityEmitType\n    const parentVM = getVcParentInstance(vcInstance).proxy as VcComponentPublicInstance\n    return parentVM && parentVM.__updateGraphics?.(undefined, emitType)\n  }\n}\n"],"names":[],"mappings":";;;;AAGe,oBAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE;AAChD,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAClD,EAAE,MAAM,WAAW,GAAG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