修改自定义颜色插件

This commit is contained in:
zh
2025-07-16 15:02:18 +08:00
parent a43c71d94e
commit ea7feea226
47 changed files with 2109 additions and 1982 deletions

View File

@ -25,7 +25,7 @@ class PolygonObject extends Base {
* @param options.id {string} 唯一标识
* @param options.show=true {boolean} 显示/隐藏
* @param options.name {string} 名称
* @param options.color="#ff000080" {string} 颜色
* @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色
* @param options.height {number} 高度
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
* @param options.line {object} 边框
@ -39,7 +39,7 @@ class PolygonObject extends Base {
constructor(sdk, options = {}, _Dialog = {}) {
super(sdk, options)
this.options.name = options.name || '未命名对象'
this.options.color = options.color || '#ff000080'
this.options.color = options.color || 'rgba(255, 0, 0, 0.5)'
this.options.show =
options.show || options.show === false ? options.show : true
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
@ -47,7 +47,7 @@ class PolygonObject extends Base {
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color =
this.options.line.color || '#ff000080'
this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity
this.event = new MouseEvent(this.sdk)
@ -133,7 +133,7 @@ class PolygonObject extends Base {
return this.options.color
}
set color(v) {
this.options.color = v || '#ff000080'
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
return
}
@ -150,7 +150,7 @@ class PolygonObject extends Base {
this.entity.polygon.material = material
if (this._elms.color) {
this._elms.color.forEach((item, i) => {
let colorPicker = new ewPlugins('colorpicker', {
let colorPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -269,14 +269,14 @@ class PolygonObject extends Base {
return this.options.line.color
}
set lineColor(v) {
this.options.line.color = v || '#ff000080'
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
return
}
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
if (this._elms.lineColor) {
this._elms.lineColor.forEach((item, i) => {
let lineColorPicker = new ewPlugins('colorpicker', {
let lineColorPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -389,7 +389,7 @@ class PolygonObject extends Base {
this.label.color = v
if (this._elms.labelColor) {
this._elms.labelColor.forEach((item, i) => {
let labelColorPicker = new ewPlugins('colorpicker', {
let labelColorPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -493,7 +493,7 @@ class PolygonObject extends Base {
this.label.lineColor = v
if (this._elms.labelLineColor) {
this._elms.labelLineColor.forEach((item, i) => {
let lineColorPicker = new ewPlugins('colorpicker', {
let lineColorPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -520,7 +520,7 @@ class PolygonObject extends Base {
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
if (this._elms.labelBackgroundColorStart) {
this._elms.labelBackgroundColorStart.forEach((item, i) => {
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
let labelBackgroundColorStartPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -548,7 +548,7 @@ class PolygonObject extends Base {
this.label.backgroundColor = [this.label.backgroundColor[0], v]
if (this._elms.labelBackgroundColorEnd) {
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
let labelBackgroundColorEndPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -1270,7 +1270,7 @@ class PolygonObject extends Base {
// 创建标签页
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
// 颜色组件
let colorPicker = new ewPlugins('colorpicker', {
let colorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('color')[0],
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -1284,7 +1284,7 @@ class PolygonObject extends Base {
this.color = 'rgba(255,255,255,1)'
} //点击清空按钮事件回调
})
let linecolorPicker = new ewPlugins('colorpicker', {
let linecolorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('lineColor')[0],
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -1298,7 +1298,7 @@ class PolygonObject extends Base {
this.lineColor = 'rgba(255,255,255,1)'
} //点击清空按钮事件回调
})
let labelColorPicker = new ewPlugins('colorpicker', {
let labelColorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('labelColor')[0],
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -1312,7 +1312,7 @@ class PolygonObject extends Base {
this.labelColor = 'rgba(255,255,255,1)'
} //点击清空按钮事件回调
})
let lineColorPicker = new ewPlugins('colorpicker', {
let lineColorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('labelLineColor')[0],
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
@ -1326,7 +1326,7 @@ class PolygonObject extends Base {
this.labelLineColor = 'rgba(255,255,255,1)'
} //点击清空按钮事件回调
})
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
let labelBackgroundColorStartPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0],
size: 'mini',
alpha: true,
@ -1340,7 +1340,7 @@ class PolygonObject extends Base {
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
}
})
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
let labelBackgroundColorEndPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0],
size: 'mini',
alpha: true,