{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitives/particle/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-03-23 10:29:32\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\primitives\\particle\\index.ts\n */\nimport type { PropType } from 'vue'\nimport { createCommentVNode, defineComponent, getCurrentInstance } from 'vue'\nimport type {\n  VcCartesian2,\n  VcColor,\n  VcComponentInternalInstance,\n  VcComponentPublicInstance,\n  VcPickEvent,\n  VcReadyObject\n} from '@vue-cesium/utils/types'\nimport { usePrimitives } from '@vue-cesium/composables'\nimport {\n  show,\n  modelMatrix,\n  image,\n  color,\n  startColor,\n  endColor,\n  imageSize,\n  minimumImageSize,\n  maximumImageSize,\n  sizeInMeters,\n  enableMouseEvent\n} from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { primitiveEmits } from '@vue-cesium/utils/emits'\n\nconst emits = {\n  ...primitiveEmits,\n  complete: (evt: Cesium.ParticleSystem) => true\n}\nexport const particlePrimitiveProps = {\n  ...show,\n  updateCallback: Function,\n  emitter: Object as PropType<Cesium.ParticleEmitter>,\n  ...modelMatrix,\n  emitterModelMatrix: Object as PropType<Cesium.Matrix4>,\n  emissionRate: {\n    type: Number,\n    default: 5\n  },\n  bursts: Array as PropType<Array<Cesium.ParticleBurst>>,\n  loop: {\n    type: Boolean,\n    default: true\n  },\n  scale: {\n    type: Number,\n    default: 1.0\n  },\n  startScale: Number,\n  endScale: Number,\n  ...color,\n  ...startColor,\n  ...endColor,\n  ...image,\n  ...imageSize,\n  ...minimumImageSize,\n  ...maximumImageSize,\n  ...sizeInMeters,\n  speed: {\n    type: Number,\n    default: 1.0\n  },\n  minimumSpeed: Number,\n  maximumSpeed: Number,\n  lifetime: {\n    type: Number,\n    default: Number.MAX_VALUE\n  },\n  particleLife: {\n    type: Number,\n    default: 5.0\n  },\n  minimumParticleLife: Number,\n  maximumParticleLife: Number,\n  mass: {\n    type: Number,\n    default: 1.0\n  },\n  minimumMass: Number,\n  maximumMass: Number,\n  ...enableMouseEvent\n}\nexport default defineComponent({\n  name: 'VcPrimitiveParticle',\n  props: particlePrimitiveProps,\n  emits: emits,\n  setup(props, ctx) {\n    // state\n    const instance = getCurrentInstance() as VcComponentInternalInstance\n    instance.cesiumClass = 'ParticleSystem'\n    instance.cesiumEvents = ['complete']\n    usePrimitives(props, ctx, instance)\n    return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n  }\n})\n\nexport type VcPrimitiveParticleEmits = typeof emits\nexport type VcPrimitiveParticleProps = {\n  /**\n   * Whether to display the particle system.\n   * Default value: true\n   */\n  show?: boolean\n  /**\n   * The callback function to be called each frame to update a particle.\n   */\n  updateCallback?: (particle: Cesium.Particle, dt: number) => void\n  /**\n   * The particle emitter for this system.\n   */\n  emitter?: Cesium.ParticleEmitter\n  /**\n   * The 4x4 transformation matrix that transforms the particle system from model to world coordinates.\n   */\n  modelMatrix?: Cesium.Matrix4\n  /**\n   * The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.\n   */\n  emitterModelMatrix?: Cesium.Matrix4\n  /**\n   * The number of particles to emit per second.\n   * Default value: 5.0\n   */\n  emissionRate?: number\n  /**\n   * An array of ParticleBurst, emitting bursts of particles at periodic times.\n   */\n  bursts?: Array<Cesium.ParticleBurst>\n  /**\n   * Whether the particle system should loop its bursts when it is complete.\n   * Default: true\n   */\n  loop?: boolean\n  /**\n   * Sets the scale to apply to the image of the particle for the duration of its particleLife.\n   * Default value: 1.0\n   */\n  scale?: number\n  /**\n   * The initial scale to apply to the image of the particle at the beginning of its life.\n   */\n  startScale?: number\n  /**\n   * The final scale to apply to the image of the particle at the end of its life.\n   */\n  endScale?: number\n  /**\n   * Sets the color of a particle for the duration of its particleLife.\n   * Default value: white\n   */\n  color?: VcColor\n  /**\n   * The color of the particle at the beginning of its life.\n   */\n  startColor?: VcColor\n  /**\n   * The color of the particle at the end of its life.\n   */\n  endColor?: VcColor\n  /**\n   * The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.\n   */\n  image?: string | HTMLImageElement | HTMLCanvasElement\n  /**\n   * If set, overrides the minimumImageSize and maximumImageSize inputs that scale the particle image's dimensions in pixels.\n   */\n  imageSize?: VcCartesian2\n  /**\n   * Sets the minimum bound, width by height, above which to randomly scale the particle image's dimensions in pixels.\n   */\n  minimumImageSize?: VcCartesian2\n  /**\n   * Sets the maximum bound, width by height, below which to randomly scale the particle image's dimensions in pixels.\n   */\n  maximumImageSize?: VcCartesian2\n  /**\n   * Sets if the size of particles is in meters or pixels. true to size the particles in meters; otherwise, the size is in pixels.\n   */\n  sizeInMeters?: boolean\n  /**\n   * If set, overrides the minimumSpeed and maximumSpeed inputs with this value.\n   * Default value: 1.0\n   */\n  speed?: number\n  /**\n   * Sets the minimum bound in meters per second above which a particle's actual speed will be randomly chosen.\n   */\n  minimumSpeed?: number\n  /**\n   * Sets the maximum bound in meters per second below which a particle's actual speed will be randomly chosen.\n   */\n  maximumSpeed?: number\n  /**\n   * How long the particle system will emit particles, in seconds.\n   * Default value: Number.MAX_VALUE\n   */\n  lifetime?: number\n  /**\n   * If set, overrides the minimumParticleLife and maximumParticleLife inputs with this value.\n   * Default value: 5.0\n   */\n  particleLife?: number\n  /**\n   * Sets the minimum bound in seconds for the possible duration of a particle's life above which a particle's actual life will be randomly chosen.\n   */\n  minimumParticleLife?: number\n  /**\n   * Sets the maximum bound in seconds for the possible duration of a particle's life below which a particle's actual life will be randomly chosen.\n   */\n  maximumParticleLife?: number\n  /**\n   * Sets the minimum and maximum mass of particles in kilograms.\n   * Default value: 1.0\n   */\n  mass?: number\n  /**\n   * Sets the minimum bound for the mass of a particle in kilograms. A particle's actual mass will be chosen as a random amount above this value.\n   */\n  minimumMass?: number\n  /**\n   * Sets the maximum mass of particles in kilograms. A particle's actual mass will be chosen as a random amount below this value.\n   */\n  maximumMass?: 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 load failed.\n   */\n  onUnready?: (e: any) => 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  onMousedown?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse bounces up on this primitive.\n   */\n  onMouseup?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks on this primitive.\n   */\n  onClick?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks outside this primitive.\n   */\n  onClickout?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the left mouse button double-clicks this primitive.\n   */\n  onDblclick?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves on this primitive.\n   */\n  onMousemove?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves over to this primitive.\n   */\n  onMouseover?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves out of this primitive.\n   */\n  onMouseout?: (evt: VcPickEvent) => void\n}\n\nexport type VcPrimitiveParticleRef = VcComponentPublicInstance<VcPrimitiveParticleProps>\n"],"names":[],"mappings":";;;;;;;;AAmCA,MAAM,KAAQ,GAAA;AAAA,EACZ,GAAG,cAAA;AAAA,EACH,QAAA,EAAU,CAAC,GAA+B,KAAA,IAAA;AAC5C,CAAA,CAAA;AACO,MAAM,sBAAyB,GAAA;AAAA,EACpC,GAAG,IAAA;AAAA,EACH,cAAgB,EAAA,QAAA;AAAA,EAChB,OAAS,EAAA,MAAA;AAAA,EACT,GAAG,WAAA;AAAA,EACH,kBAAoB,EAAA,MAAA;AAAA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