CreditDisplay

new Cesium.CreditDisplay(container, delimiter, viewport)

The credit display is responsible for displaying credits on screen.
参数名称 类型 默认值 描述信息
container HTMLElement The HTML element where credits will be displayed
delimiter string '•' 可选 The string to separate text credits
viewport HTMLElement document.body 可选 The HTML element that will contain the credits popup
使用示例s:
// Add a credit with a tooltip, image and link to display onscreen
const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
viewer.creditDisplay.addStaticCredit(credit);
// Add a credit with a plaintext link to display in the lightbox
const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
viewer.creditDisplay.addStaticCredit(credit);

成员(属性)

static Cesium.CreditDisplay.cesiumCredit : Credit

Gets or sets the Cesium logo credit.
The HTML element where credits will be displayed.

方法

addCreditToNextFrame(credit)

Adds a Credit that will show on screen or in the lightbox until the next frame. This is mostly for internal use. Use CreditDisplay.addStaticCredit to add a persistent credit to the screen.
参数名称 类型 描述信息
credit Credit The credit to display in the next frame.
参考:
  • CreditDisplay.addStaticCredit
Adds a Credit that will show on screen or in the lightbox until removed with CreditDisplay.removeStaticCredit.
参数名称 类型 描述信息
credit Credit The credit to added
使用示例s:
// Add a credit with a tooltip, image and link to display onscreen
const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
viewer.creditDisplay.addStaticCredit(credit);
// Add a credit with a plaintext link to display in the lightbox
const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
viewer.creditDisplay.addStaticCredit(credit);
Resets the credit display to a beginning of frame state, clearing out current credits.
Destroys the resources held by this object. Destroying an object allows for deterministic release of resources, instead of relying on the garbage collector to destroy this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Sets the credit display to the end of frame state, displaying credits from the last frame in the credit container.

isDestroyed()boolean

Returns true if this object was destroyed; otherwise, false.

返回值:
true if this object was destroyed; otherwise, false.

removeStaticCredit(credit)

Removes a static credit shown on screen or in the lightbox.
参数名称 类型 描述信息
credit Credit The credit to be removed.
Updates the credit display before a new frame is rendered.