增加标注图片地址404判断
This commit is contained in:
@ -231,7 +231,20 @@ class BillboardObject extends Base {
|
|||||||
that._superGif = superGif
|
that._superGif = superGif
|
||||||
that._superGif.id = id // 自定义id,用于判断gif实例是否改变
|
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) {
|
if (that._superGif.id != id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -286,6 +299,17 @@ class BillboardObject extends Base {
|
|||||||
addCluster(that.sdk, that.entity)
|
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({
|
that.entity = new Cesium.Entity({
|
||||||
@ -729,7 +753,24 @@ class BillboardObject extends Base {
|
|||||||
let billboardH = 36
|
let billboardH = 36
|
||||||
let index = 0
|
let index = 0
|
||||||
_this._frameImages = []
|
_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) {
|
if (_this._superGif.id != id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -802,6 +843,21 @@ class BillboardObject extends Base {
|
|||||||
}, false)
|
}, false)
|
||||||
billboardH = height * (31 / width)
|
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 () {
|
this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
|
||||||
if (_this.options.billboard.show) {
|
if (_this.options.billboard.show) {
|
||||||
let billboardH =
|
let billboardH = _this.entity.billboard.imgHeight ?
|
||||||
_this.entity.billboard.imgHeight *
|
_this.entity.billboard.imgHeight *
|
||||||
(31 / _this.entity.billboard.imgWidth)
|
(31 / _this.entity.billboard.imgWidth) : 0
|
||||||
return new Cesium.Cartesian2(
|
return new Cesium.Cartesian2(
|
||||||
0,
|
0,
|
||||||
-billboardH * _this.options.billboard.scale -
|
-billboardH * _this.options.billboard.scale -
|
||||||
@ -2224,7 +2280,7 @@ class BillboardObject extends Base {
|
|||||||
.value
|
.value
|
||||||
) {
|
) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: this._DialogObject._element.content.getElementsByClassName(
|
url: this._DialogObject._element.content.getElementsByClassName(
|
||||||
'vr_add'
|
'vr_add'
|
||||||
)[0].value
|
)[0].value
|
||||||
@ -2240,7 +2296,7 @@ class BillboardObject extends Base {
|
|||||||
|
|
||||||
addAttributeRr(vr) {
|
addAttributeRr(vr) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: vr
|
url: vr
|
||||||
})
|
})
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
this.attributeVr = this.options.attribute.vr.content
|
||||||
|
8
static/3rdparty/libgif.js
vendored
8
static/3rdparty/libgif.js
vendored
@ -926,8 +926,14 @@
|
|||||||
get_current_frame: function() { return player.current_frame() },
|
get_current_frame: function() { return player.current_frame() },
|
||||||
load_url: function(src,callback){
|
load_url: function(src,callback){
|
||||||
if (!load_setup(callback)) return;
|
if (!load_setup(callback)) return;
|
||||||
|
|
||||||
var h = new XMLHttpRequest();
|
var h = new XMLHttpRequest();
|
||||||
|
h.onreadystatechange = function() {
|
||||||
|
if (h.readyState == 4) {
|
||||||
|
if (h.status == 404) {
|
||||||
|
callback(404)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
// new browsers (XMLHttpRequest2-compliant)
|
// new browsers (XMLHttpRequest2-compliant)
|
||||||
h.open('GET', src, true);
|
h.open('GET', src, true);
|
||||||
|
|
||||||
|
@ -1599,6 +1599,10 @@
|
|||||||
width: 23px;
|
width: 23px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
cursor: pointer;
|
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 {
|
.YJ-custom-base-dialog.billboard-object>.content div .image {
|
||||||
|
Reference in New Issue
Block a user