Fix all panel styling applied to same widget

#2374
This commit is contained in:
Charles Gagnon
2025-09-12 18:38:14 -04:00
parent 44be0a739f
commit a1fb0cb7f8

View File

@@ -48,7 +48,7 @@ export const DynamicTransparency = class {
} }
updateExternalStyle() { updateExternalStyle() {
this._setStyle() this._setBackground()
} }
_bindSignals() { _bindSignals() {
@@ -144,31 +144,29 @@ export const DynamicTransparency = class {
this._updateColor(themeBackground) this._updateColor(themeBackground)
this._updateAlpha(themeBackground) this._updateAlpha(themeBackground)
this._updateBorder() this._updateBorder()
this._updateBackground()
this._updateGradient() this._updateGradient()
this._setStyle() this._setBackground()
this._setGradientAndBorder()
} }
_updateColorAndSet() { _updateColorAndSet() {
this._updateColor() this._updateColor()
this._updateBackground() this._setBackground()
this._setStyle()
} }
_updateAlphaAndSet() { _updateAlphaAndSet() {
this._updateAlpha() this._updateAlpha()
this._updateBackground() this._setBackground()
this._setStyle()
} }
_updateBorderAndSet() { _updateBorderAndSet() {
this._updateBorder() this._updateBorder()
this._setStyle() this._setGradientAndBorder()
} }
_updateGradientAndSet() { _updateGradientAndSet() {
this._updateGradient() this._updateGradient()
this._setStyle() this._setGradientAndBorder()
} }
_updateColor(themeBackground) { _updateColor(themeBackground) {
@@ -218,7 +216,7 @@ export const DynamicTransparency = class {
borderPosition = 'top' borderPosition = 'top'
} }
const style = `border: 0 solid ${rgba}; border-${borderPosition}-width:${borderWidth}px; ` const style = `border: 0 solid ${rgba}; border-${borderPosition}-width:${borderWidth}px;`
this._borderStyle = showBorder ? style : '' this._borderStyle = showBorder ? style : ''
} }
@@ -226,8 +224,6 @@ export const DynamicTransparency = class {
this._gradientStyle = '' this._gradientStyle = ''
if (SETTINGS.get_boolean('trans-use-custom-gradient')) { if (SETTINGS.get_boolean('trans-use-custom-gradient')) {
this._backgroundStyle =
'background: none; border-image: none; background-image: none;'
this._gradientStyle += this._gradientStyle +=
'background-gradient-direction: ' + 'background-gradient-direction: ' +
(this._dtpPanel.geom.vertical ? 'horizontal;' : 'vertical;') + (this._dtpPanel.geom.vertical ? 'horizontal;' : 'vertical;') +
@@ -241,28 +237,31 @@ export const DynamicTransparency = class {
SETTINGS.get_string('trans-gradient-bottom-color'), SETTINGS.get_string('trans-gradient-bottom-color'),
SETTINGS.get_double('trans-gradient-bottom-opacity'), SETTINGS.get_double('trans-gradient-bottom-opacity'),
) )
} else {
this._updateBackground()
} }
} }
_updateBackground() { _setBackground() {
this.currentBackgroundColor = Utils.getrgbaColor( this.currentBackgroundColor = Utils.getrgbaColor(
this.backgroundColorRgb, this.backgroundColorRgb,
this.alpha, this.alpha,
) )
this._backgroundStyle = `background-color: ${this.currentBackgroundColor}` let transition = 'transition-duration:' + this.animationDuration
this._dtpPanel.set_style(
'background-color: ' + this.currentBackgroundColor + transition,
)
} }
_setStyle() { _setGradientAndBorder() {
const transition = 'transition-duration:' + this.animationDuration
this._dtpPanel.panel.set_style( this._dtpPanel.panel.set_style(
transition + 'background: none; ' +
this._backgroundStyle + 'border-image: none; ' +
'background-image: none; ' +
this._gradientStyle + this._gradientStyle +
this._borderStyle, this._borderStyle +
'transition-duration:' +
this.animationDuration,
) )
} }