vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 10.3 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitive-collections/billboard/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-03-11 10:04:36\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\primitive-collections\\billboard\\index.ts\n */\nimport { createCommentVNode, defineComponent, getCurrentInstance } from 'vue'\nimport type {\n VcPickEvent,\n VcCartesian2,\n VcColor,\n VcComponentInternalInstance,\n VcDistanceDisplayCondition,\n VcNearFarScalar,\n VcPosition,\n VcReadyObject,\n VcComponentPublicInstance\n} from '@vue-cesium/utils/types'\nimport { usePrimitiveCollectionItems } from '@vue-cesium/composables'\nimport {\n alignedAxis,\n color,\n disableDepthTestDistance,\n distanceDisplayCondition,\n eyeOffset,\n height,\n heightReference,\n horizontalOrigin,\n id,\n image,\n pixelOffset,\n pixelOffsetScaleByDistance,\n position,\n rotation,\n scale,\n scaleByDistance,\n show,\n sizeInMeters,\n translucencyByDistance,\n verticalOrigin,\n width,\n enableMouseEvent\n} from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { primitiveCollectionEmits } from '@vue-cesium/utils/emits'\n\nexport const billboardProps = {\n ...alignedAxis,\n ...color,\n ...disableDepthTestDistance,\n ...distanceDisplayCondition,\n ...eyeOffset,\n ...height,\n ...heightReference,\n ...horizontalOrigin,\n ...id,\n ...image,\n ...pixelOffset,\n ...pixelOffsetScaleByDistance,\n ...position,\n ...rotation,\n ...scale,\n ...scaleByDistance,\n ...show,\n ...sizeInMeters,\n ...translucencyByDistance,\n ...verticalOrigin,\n ...width,\n ...enableMouseEvent\n}\nexport default defineComponent({\n name: 'VcBillboard',\n props: billboardProps,\n emits: primitiveCollectionEmits,\n setup(props, ctx) {\n // state\n const instance = getCurrentInstance() as VcComponentInternalInstance\n instance.cesiumClass = 'Billboard'\n usePrimitiveCollectionItems(props, ctx, instance)\n\n return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n }\n})\n\nexport type VcBillboardProps = {\n /**\n * Specify the aligned axis in world space. The aligned axis is the unit vector that the billboard up vector points towards. The default is the zero vector, which means the billboard is aligned to the screen up vector.\n */\n alignedAxis?: VcPosition\n /**\n * Specify the color that is multiplied with the billboard's texture. This has two common use cases. First, the same white texture may be used by many different billboards, each with a different color, to create colored billboards. Second, the color's alpha component can be used to make the billboard translucent as shown below. An alpha of 0.0 makes the billboard transparent, and 1.0 makes the billboard opaque.\n * Default value: white\n */\n color?: VcColor\n /**\n * Specify the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.\n */\n disableDepthTestDistance?: number\n /**\n * Specify the condition specifying at what distance from the camera that this billboard will be displayed.\n */\n distanceDisplayCondition?: VcDistanceDisplayCondition\n /**\n * Specify the 3D offset applied to this billboard in eye coordinates. Eye coordinates is a left-handed coordinate system, where x points towards the viewer's right, y points up, and z points into the screen. Eye coordinates use the same scale as world and model coordinates, which is typically meters.\n */\n eyeOffset?: VcPosition\n /**\n * Specify a height for the billboard. If undefined, the image height will be used.\n */\n height?: number\n /**\n * Specify the height reference of this billboard.\n */\n heightReference?: number\n /**\n * Specify the horizontal origin of this billboard, which determines if the billboard is to the left, center, or right of its anchor position.\n * Default value: 0\n */\n horizontalOrigin?: number\n /**\n * Specify the user-defined object returned when the billboard is picked.\n */\n id?: any\n /**\n * Specify the image to be used for this billboard. If a texture has already been created for the given image, the existing texture is used.\n */\n image?: string\n /**\n * Specify the pixel offset in screen space from the origin of this billboard. This is commonly used to align multiple billboards and labels at the same position, e.g., an image and text. The screen space origin is the top, left corner of the canvas; x increases from left to right, and y increases from top to bottom.\n * Default value: { x:0, y: 0 }\n */\n pixelOffset?: VcCartesian2\n /**\n * Specify near and far pixel offset scaling properties of a Billboard based on the billboard's distance from the camera. A billboard's pixel offset will be scaled between the NearFarScalar#nearValue and NearFarScalar#farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far. Outside of these ranges the billboard's pixel offset scale remains clamped to the nearest bound. If undefined, pixelOffsetScaleByDistance will be disabled.\n */\n pixelOffsetScaleByDistance?: VcNearFarScalar\n /**\n * Specify the position of this billboard.\n */\n position?: VcPosition\n /**\n * Specify the rotation angle in radians.\n */\n rotation?: number\n /**\n * Specify the uniform scale that is multiplied with the billboard's image size in pixels. A scale of 1.0 does not change the size of the billboard; a scale greater than 1.0 enlarges the billboard; a positive scale less than 1.0 shrinks the billboard.\n */\n scale?: number\n /**\n * Specify near and far scaling properties of a Billboard based on the billboard's distance from the camera. A billboard's scale will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far. Outside of these ranges the billboard's scale remains clamped to the nearest bound. If undefined, scaleByDistance will be disabled.\n */\n scaleByDistance?: VcNearFarScalar\n /**\n * Determines if this billboard will be shown. Use this to hide or show a billboard, instead of removing it and re-adding it to the collection.\n */\n show?: boolean\n /**\n * Determines if the billboard size is in meters or pixels. true to size the billboard in meters; otherwise, the size is in pixels.\n */\n sizeInMeters?: boolean\n /**\n * Specify near and far translucency properties of a Billboard based on the billboard's distance from the camera. A billboard's translucency will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far. Outside of these ranges the billboard's translucency remains clamped to the nearest bound. If undefined, translucencyByDistance will be disabled.\n */\n translucencyByDistance?: VcNearFarScalar\n /**\n * Specify the vertical origin of this billboard, which determines if the billboard is to the above, below, or at the center of its anchor position.\n */\n verticalOrigin?: number\n /**\n * Specify a width for the billboard. If undefined, the image width will be used.\n */\n width?: number\n /**\n * Specifies whether to respond to mouse pick events.\n * Default Value: true\n */\n enableMouseEvent?: boolean\n /**\n * Triggers before the VcBillboard is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the VcBillboard 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 VcBillboard is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the mouse is pressed on this billboard.\n */\n onMousedown?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse bounces up on this billboard.\n */\n onMouseup?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks on this billboard.\n */\n onClick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks outside this billboard.\n */\n onClickout?: (evt: VcPickEvent) => void\n /**\n * Triggers when the left mouse button double-clicks this billboard.\n */\n onDblclick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves on this billboard.\n */\n onMousemove?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves over to this billboard.\n */\n onMouseover?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves out of this billboard.\n */\n onMouseout?: (evt: VcPickEvent) => void\n}\n\nexport type VcBillboardRef = VcComponentPublicInstance<VcBillboardProps>\n"],"names":[],"mappings":";;;;;;;;AAgDO,MAAM,cAAiB,GAAA;AAAA,EAC5B,GAAG,WAAA;AAAA,EACH,GAAG,KAAA;AAAA,EACH,GAAG,wBAAA;AAAA,EACH,GAAG,wBAAA;AAAA,EACH,GAAG,SAAA;AAAA,EACH,GAAG,MAAA;AAAA,EACH,GAAG,eAAA;AAAA,EACH,GAAG,gBAAA;AAAA,EACH,GAAG,EAAA;AAAA,EACH,GAAG,KAAA;AAAA,EACH,GAAG,WAAA;AAAA,EACH,GAAG,0BAAA;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG,KAAA;AAAA,EACH,GAAG,eAAA;AAAA,EACH,GAAG,IAAA;AAAA,EACH,GAAG,YAAA;AAAA,EACH,GAAG,sBAAA;AAAA,EACH,GAAG,cAAA;AAAA,EACH,GAAG,KAAA;AAAA,EACH,GAAG,gBAAA;AACL,EAAA;AACA,gBAAe,eAAgB,CAAA;AAAA,EAC7B,IAAM,EAAA,aAAA;AAAA,EACN,KAAO,EAAA,cAAA;AAAA,EACP,KAAO,EAAA,wBAAA;AAAA,EACP,KAAA,CAAM,OAAO,GAAK,EAAA;AAEhB,IAAA,MAAM,WAAW,kBAAmB,EAAA,CAAA;AACpC,IAAA,QAAA,CAAS,WAAc,GAAA,WAAA,CAAA;AACvB,IAA4B,2BAAA,CAAA,KAAA,EAAO,KAAK,QAAQ,CAAA,CAAA;AAEhD,IAAA,OAAO,MAAG;AAlFd,MAAA,IAAA,EAAA,CAAA;AAkFiB,MAAA,OAAA,kBAAA,CAAmB,YAAU,EAAS,GAAA,QAAA,CAAA,KAAA,KAAT,mBAAgB,QAAS,CAAA,IAAA,KAAQ,EAAE,CAAC,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAChF;AACF,CAAC,CAAA;;;;"}