Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop

This commit is contained in:
zh
2025-07-04 13:58:04 +08:00
3 changed files with 73 additions and 7 deletions

View File

@ -231,7 +231,20 @@ class BillboardObject extends Base {
that._superGif = superGif
that._superGif.id = id // 自定义id用于判断gif实例是否改变
superGif.load(function () {
superGif.load(function (status) {
if (status == 404) {
canvas = document.createElement('canvas')
canvas.width = 0
canvas.height = 0
billboardH = 0
if (that.entity) {
that.entity.billboard.imgWidth = 0
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
}
return
}
if (that._superGif.id != id) {
return
}
@ -286,6 +299,17 @@ class BillboardObject extends Base {
addCluster(that.sdk, that.entity)
}
}
image.onerror = function (err) {
canvas.width = 0
canvas.height = 0
billboardH = 0
if (that.entity) {
that.entity.billboard.imgWidth = 0
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
}
};
}
that.entity = new Cesium.Entity({
@ -729,7 +753,24 @@ class BillboardObject extends Base {
let billboardH = 36
let index = 0
_this._frameImages = []
superGif.load(function () {
superGif.load(function (status) {
if (status == 404) {
canvas = document.createElement('canvas')
canvas.width = 0
canvas.height = 0
billboardH = 0
_this.entity.billboard.imgWidth = 0
_this.entity.billboard.imgHeight = 0
_this.entity && (_this.entity.billboard.image = canvas)
_this.entity.billboard.height = new Cesium.CallbackProperty(function () {
return 0
}, false)
_this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
return new Cesium.Cartesian2(0, 0)
}, false)
billboardH = height * (31 / width)
return
}
if (_this._superGif.id != id) {
return
}
@ -802,6 +843,21 @@ class BillboardObject extends Base {
}, false)
billboardH = height * (31 / width)
}
image.onerror = function (err) {
canvas.width = 0
canvas.height = 0
billboardH = 0
_this.entity.billboard.imgWidth = 0
_this.entity.billboard.imgHeight = 0
_this.entity && (_this.entity.billboard.image = canvas)
_this.entity.billboard.height = new Cesium.CallbackProperty(function () {
return 0
}, false)
_this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
return new Cesium.Cartesian2(0, 0)
}, false)
billboardH = height * (31 / width)
};
}
}
@ -2077,9 +2133,9 @@ class BillboardObject extends Base {
// )
this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
if (_this.options.billboard.show) {
let billboardH =
let billboardH = _this.entity.billboard.imgHeight ?
_this.entity.billboard.imgHeight *
(31 / _this.entity.billboard.imgWidth)
(31 / _this.entity.billboard.imgWidth) : 0
return new Cesium.Cartesian2(
0,
-billboardH * _this.options.billboard.scale -

View File

@ -926,8 +926,14 @@
get_current_frame: function() { return player.current_frame() },
load_url: function(src,callback){
if (!load_setup(callback)) return;
var h = new XMLHttpRequest();
h.onreadystatechange = function() {
if (h.readyState == 4) {
if (h.status == 404) {
callback(404)
}
}
};
// new browsers (XMLHttpRequest2-compliant)
h.open('GET', src, true);

View File

@ -1599,6 +1599,10 @@
width: 23px;
height: 26px;
cursor: pointer;
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.2);
display: flex;
align-items: center;
justify-content: center;
}
.YJ-custom-base-dialog.billboard-object>.content div .image {