修改自定义颜色插件

This commit is contained in:
zh
2025-07-16 17:45:32 +08:00
parent 6a71f41a19
commit 32066bbf99
2 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ class YJColorPicker {
clickDefineColor: clickDefineColor,
hasClear: true,
openPickerAni: 'opacity',
defaultColor: options.defaultColor || '#ffffff',
defaultColor: options.defaultColor,
startMainCallback: (t) => {
customizeStyle()
}
@ -37,6 +37,7 @@ class YJColorPicker {
if (pickAlphaInput) {
pickAlphaInput.value = this.pickAlphaInputValue = 100
}
this.colorPicker.config.defaultColor = ''
customizeStyle()
if (typeof options.clear == 'function') {
options.clear()
@ -51,9 +52,8 @@ class YJColorPicker {
// }, this.colorPicker.config.pickerAnimationTime);
}
}
let CesiumColor = Cesium.Color.fromCssColorString(config.defaultColor)
if (!CesiumColor) {
config.defaultColor = '#ffffff'
let CesiumColor
if(config.defaultColor) {
CesiumColor = Cesium.Color.fromCssColorString(config.defaultColor)
}
// if (options.predefineColor) {
@ -61,7 +61,7 @@ class YJColorPicker {
// }
config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)']
this.colorPicker = new ewPlugins('colorpicker', config)
window.colorPicker = this.colorPicker
// window.colorPicker = this.colorPicker
customizeStyle()
@ -121,13 +121,13 @@ class YJColorPicker {
pickAlphaInput.value = Number(Number(_this.pickAlphaInputValue).toFixed(2))
}
else {
pickAlphaInput.value = Number((CesiumColor.alpha * 100).toFixed(2))
pickAlphaInput.value = CesiumColor ? Number((CesiumColor.alpha * 100).toFixed(2)) : 100
}
_this.pickAlphaInputValue = pickAlphaInput.value
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(pickAlphaInput.value / 100).toCssColorString()
}
else {
CesiumColor = CesiumColor.withAlpha(1)
CesiumColor = CesiumColor ? CesiumColor.withAlpha(1) : ''
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').toCssColorString()
}

View File

@ -740,7 +740,7 @@
function p(e, t) {
// c(e.box, "background", (0,
// o.colorHsbaToRgba)(e.hsba)),
c(e.arrowRight, "border-top-color", (0,
e.arrowRight && c(e.arrowRight, "border-top-color", (0,
o.colorHsbaToRgba)(e.hsba)),
t || e.config.alpha ? e.pickerInput.value = (0,
o.colorHsbaToRgba)(e.hsba) : e.pickerInput.value = (0,