mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Drop ES5 support
This commit is contained in:
@@ -28,10 +28,9 @@ const Panel = Me.imports.panel;
|
||||
const Proximity = Me.imports.proximity;
|
||||
const Utils = Me.imports.utils;
|
||||
|
||||
var DynamicTransparency = Utils.defineClass({
|
||||
Name: 'DashToPanel.DynamicTransparency',
|
||||
var DynamicTransparency = class {
|
||||
|
||||
_init: function(dtpPanel) {
|
||||
constructor(dtpPanel) {
|
||||
this._dtpPanel = dtpPanel;
|
||||
this._proximityManager = dtpPanel.panelManager.proximityManager;
|
||||
this._proximityWatchId = 0;
|
||||
@@ -50,9 +49,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._updateAnimationDuration();
|
||||
this._updateAllAndSet();
|
||||
this._updateProximityWatch();
|
||||
},
|
||||
}
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._signalsHandler.destroy();
|
||||
this._proximityManager.removeWatch(this._proximityWatchId);
|
||||
|
||||
@@ -62,14 +61,14 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._dtpPanel.panel._leftCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
this._dtpPanel.panel._rightCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
updateExternalStyle: function() {
|
||||
updateExternalStyle() {
|
||||
this._updateComplementaryStyles();
|
||||
this._setBackground();
|
||||
},
|
||||
}
|
||||
|
||||
_bindSignals: function() {
|
||||
_bindSignals() {
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
Utils.getStageTheme(),
|
||||
@@ -129,9 +128,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
() => this._updateAnimationDuration()
|
||||
]
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
_updateProximityWatch: function() {
|
||||
_updateProximityWatch() {
|
||||
this._proximityManager.removeWatch(this._proximityWatchId);
|
||||
|
||||
if (Me.settings.get_boolean('trans-use-dynamic-opacity')) {
|
||||
@@ -149,13 +148,13 @@ var DynamicTransparency = Utils.defineClass({
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
_updateAnimationDuration: function() {
|
||||
_updateAnimationDuration() {
|
||||
this.animationDuration = (Me.settings.get_int('trans-dynamic-anim-time') * 0.001) + 's;';
|
||||
},
|
||||
}
|
||||
|
||||
_updateAllAndSet: function() {
|
||||
_updateAllAndSet() {
|
||||
let themeBackground = this._getThemeBackground(true);
|
||||
|
||||
this._updateColor(themeBackground);
|
||||
@@ -164,36 +163,36 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._updateGradient();
|
||||
this._setBackground();
|
||||
this._setGradient();
|
||||
},
|
||||
}
|
||||
|
||||
_updateColorAndSet: function() {
|
||||
_updateColorAndSet() {
|
||||
this._updateColor();
|
||||
this._setBackground();
|
||||
},
|
||||
}
|
||||
|
||||
_updateAlphaAndSet: function() {
|
||||
_updateAlphaAndSet() {
|
||||
this._updateAlpha();
|
||||
this._setBackground();
|
||||
},
|
||||
}
|
||||
|
||||
_updateGradientAndSet: function() {
|
||||
_updateGradientAndSet() {
|
||||
this._updateGradient();
|
||||
this._setGradient();
|
||||
},
|
||||
}
|
||||
|
||||
_updateComplementaryStyles: function() {
|
||||
_updateComplementaryStyles() {
|
||||
let panelThemeNode = this._dtpPanel.panel.actor.get_theme_node();
|
||||
|
||||
this._complementaryStyles = 'border-radius: ' + panelThemeNode.get_border_radius(0) + 'px;';
|
||||
},
|
||||
}
|
||||
|
||||
_updateColor: function(themeBackground) {
|
||||
_updateColor(themeBackground) {
|
||||
this.backgroundColorRgb = Me.settings.get_boolean('trans-use-custom-bg') ?
|
||||
Me.settings.get_string('trans-bg-color') :
|
||||
(themeBackground || this._getThemeBackground());
|
||||
},
|
||||
}
|
||||
|
||||
_updateAlpha: function(themeBackground) {
|
||||
_updateAlpha(themeBackground) {
|
||||
if (this._windowOverlap && !Main.overview.visibleTarget && Me.settings.get_boolean('trans-use-dynamic-opacity')) {
|
||||
this.alpha = Me.settings.get_double('trans-dynamic-anim-target');
|
||||
} else {
|
||||
@@ -201,9 +200,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
Me.settings.get_double('trans-panel-opacity') :
|
||||
(themeBackground || this._getThemeBackground()).alpha * 0.003921569; // 1 / 255 = 0.003921569
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
_updateGradient: function() {
|
||||
_updateGradient() {
|
||||
this._gradientStyle = '';
|
||||
|
||||
if (Me.settings.get_boolean('trans-use-custom-gradient')) {
|
||||
@@ -213,9 +212,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
'background-gradient-end: ' + Utils.getrgbaColor(Me.settings.get_string('trans-gradient-bottom-color'),
|
||||
Me.settings.get_double('trans-gradient-bottom-opacity'));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
_setBackground: function() {
|
||||
_setBackground() {
|
||||
this.currentBackgroundColor = Utils.getrgbaColor(this.backgroundColorRgb, this.alpha);
|
||||
|
||||
let transition = 'transition-duration:' + this.animationDuration;
|
||||
@@ -227,9 +226,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._dtpPanel.panel._leftCorner.actor.set_style(cornerStyle);
|
||||
this._dtpPanel.panel._rightCorner.actor.set_style(cornerStyle);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
_setGradient: function() {
|
||||
_setGradient() {
|
||||
this._dtpPanel.panel.actor.set_style(
|
||||
'background: none; ' +
|
||||
'border-image: none; ' +
|
||||
@@ -237,9 +236,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._gradientStyle +
|
||||
'transition-duration:' + this.animationDuration
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
_getThemeBackground: function(reload) {
|
||||
_getThemeBackground(reload) {
|
||||
if (reload || !this._themeBackground) {
|
||||
let fakePanel = new St.Bin({ name: 'panel' });
|
||||
Main.uiGroup.add_child(fakePanel);
|
||||
@@ -249,9 +248,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
}
|
||||
|
||||
return this._themeBackground;
|
||||
},
|
||||
}
|
||||
|
||||
_getBackgroundImageColor: function(theme) {
|
||||
_getBackgroundImageColor(theme) {
|
||||
let bg = null;
|
||||
|
||||
try {
|
||||
@@ -267,4 +266,4 @@ var DynamicTransparency = Utils.defineClass({
|
||||
|
||||
return bg;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user