{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitives/primitive/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-01-25 11:38:17\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\primitives\\primitive\\index.ts\n */\nimport type { ExtractPropTypes } from 'vue'\nimport { createCommentVNode, defineComponent, getCurrentInstance, h } from 'vue'\nimport type { VcAppearance, VcComponentInternalInstance, VcPickEvent, VcReadyObject } from '@vue-cesium/utils/types'\nimport { usePrimitives } from '@vue-cesium/composables'\nimport {\n  geometryInstances,\n  appearance,\n  depthFailAppearance,\n  show,\n  modelMatrix,\n  vertexCacheOptimize,\n  interleave,\n  compressVertices,\n  releaseGeometryInstances,\n  allowPicking,\n  asynchronous,\n  debugShowBoundingVolume,\n  shadows,\n  enableMouseEvent\n} from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { hSlot } from '@vue-cesium/utils/private/render'\nimport { primitiveEmits } from '@vue-cesium/utils/emits'\n\nexport const primitiveProps = {\n  ...geometryInstances,\n  ...appearance,\n  ...depthFailAppearance,\n  ...show,\n  ...modelMatrix,\n  ...vertexCacheOptimize,\n  ...interleave,\n  ...compressVertices,\n  ...releaseGeometryInstances,\n  ...allowPicking,\n  cull: {\n    type: Boolean,\n    default: true\n  },\n  ...asynchronous,\n  ...debugShowBoundingVolume,\n  ...shadows,\n  ...enableMouseEvent\n}\nexport default defineComponent({\n  name: 'VcPrimitive',\n  props: primitiveProps,\n  emits: primitiveEmits,\n  setup(props, ctx) {\n    // state\n    const instance = getCurrentInstance() as VcComponentInternalInstance\n    instance.cesiumClass = 'Primitive'\n    usePrimitives(props, ctx, instance)\n\n    const name = instance.proxy?.$options.name || ''\n    return () =>\n      ctx.slots.default\n        ? h(\n            'i',\n            {\n              class: kebabCase(name),\n              style: { display: 'none !important' }\n            },\n            hSlot(ctx.slots.default)\n          )\n        : createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n  }\n})\n\n// export type VcPrimitiveProps = ExtractPropTypes<typeof primitiveProps>\nexport type VcPrimitiveProps = {\n  /**\n   * The geometry instances - or a single geometry instance - to render.\n   */\n  geometryInstances?: Cesium.GeometryInstance | Array<Cesium.GeometryInstance>\n  /**\n   * The appearance used to render the primitive.\n   */\n  appearance?: VcAppearance\n  /**\n   * The appearance used to shade this primitive when it fails the depth test.\n   */\n  depthFailAppearance?: VcAppearance\n  /**\n   * Determines if this primitive will be shown.\n   * Default value: true\n   */\n  show?: boolean\n  /**\n   * The 4x4 transformation matrix that transforms the primitive (all geometry instances) from model to world coordinates.\n   */\n  modelMatrix?: Cesium.Matrix4\n  /**\n   * When true, geometry vertices are optimized for the pre and post-vertex-shader caches.\n   * Default value: false\n   */\n  vertexCacheOptimize?: boolean\n  /**\n   * When true, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.\n   * Default value: false\n   */\n  interleave?: boolean\n  /**\n   * When true, the geometry vertices are compressed, which will save memory.\n   */\n  compressVertices?: boolean\n  /**\n   * When true, the primitive does not keep a reference to the input geometryInstances to save memory.\n   */\n  releaseGeometryInstances?: boolean\n  /**\n   * When true, each geometry instance will only be pickable with Scene#pick. When false, GPU memory is saved.\n   */\n  allowPicking?: boolean\n  /**\n   * When true, the renderer frustum culls and horizon culls the primitive's commands based on their bounding volume. Set this to false for a small performance gain if you are manually culling the primitive.\n   */\n  cull?: boolean\n  /**\n   * Determines if the primitive will be created asynchronously or block until ready.\n   */\n  asynchronous?: boolean\n  /**\n   * For debugging only. Determines if this primitive's commands' bounding spheres are shown.\n   */\n  debugShowBoundingVolume?: boolean\n  /**\n   * Determines whether this primitive casts or receives shadows from light sources.\n   */\n  shadows?: number\n  /**\n   * Specifies whether to respond to mouse pick events.\n   * Default Value: true\n   */\n  enableMouseEvent?: boolean\n  /**\n   * Triggers before the component is loaded.\n   */\n  onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the component is successfully loaded.\n   */\n  onReady?: (readyObject: VcReadyObject) => void\n  /**\n   * Triggers when the component is destroyed.\n   */\n  onDestroyed?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the mouse is pressed on this primitive.\n   */\n  mousedown?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse bounces up on this primitive.\n   */\n  mouseup?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks on this primitive.\n   */\n  click?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks outside this primitive.\n   */\n  clickout?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the left mouse button double-clicks this primitive.\n   */\n  dblclick?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves on this primitive.\n   */\n  mousemove?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves over to this primitive.\n   */\n  mouseover?: (evt: VcPickEvent) => void\n  /**\n   * \tTriggers when the mouse moves out of this primitive.\n   */\n  mouseout?: (evt: VcPickEvent) => void\n}\n"],"names":[],"mappings":";;;;;;;;AAqBY,MAAC,cAAc,GAAG;AAC9B,EAAE,GAAG,iBAAiB;AACtB,EAAE,GAAG,UAAU;AACf,EAAE,GAAG,mBAAmB;AACxB,EAAE,GAAG,IAAI;AACT,EAAE,GAAG,WAAW;AAChB,EAAE,GAAG,mBAAmB;AACxB,EAAE,GAAG,UAAU;AACf,EAAE,GAAG,gBAAgB;AACrB,EAAE,GAAG,wBAAwB;AAC7B,EAAE,GAAG,YAAY;AACjB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,GAAG,YAAY;AACjB,EAAE,GAAG,uBAAuB;AAC5B,EAAE,GAAG,OAAO;AACZ,EAAE,GAAG,gBAAgB;AACrB,EAAE;AACF,gBAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,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