浏览代码

Change the CSS of the fullscreen button

customisations
alemart 10 个月前
父节点
当前提交
4014102f11
共有 1 个文件被更改,包括 16 次插入10 次删除
  1. 16
    10
      src/ui/fullscreen-button.ts

+ 16
- 10
src/ui/fullscreen-button.ts 查看文件

@@ -89,25 +89,29 @@ export class FullscreenButton
89 89
         const button = document.createElement('button');
90 90
         const icon = document.createElement('img');
91 91
 
92
-        button.style.display = 'inline-block';
93 92
         button.style.position = 'absolute';
94 93
         button.style.bottom = BUTTON_MARGIN + 'px';
95 94
         button.style.right = BUTTON_MARGIN + 'px';
96 95
         button.style.width = BUTTON_SIZE + 'px';
97 96
         button.style.height = BUTTON_SIZE + 'px';
97
+
98
+        button.style.display = 'flex';
99
+        button.style.alignItems = 'center';
98 100
         button.style.padding = '2px';
101
+        button.style.opacity = '0.5';
102
+        button.style.outline = 'none';
103
+        button.style.cursor = 'pointer';
104
+        button.draggable = false;
99 105
 
100
-        button.style.backgroundColor = '#7c5ec2';
101
-        button.style.borderColor = '#5c3ba3';
106
+        button.style.backgroundColor = 'transparent';
107
+        button.style.borderColor = 'white';
102 108
         button.style.borderStyle = 'solid';
103 109
         button.style.borderWidth = '2px';
104 110
         button.style.borderRadius = '8px';
105
-        button.style.cursor = 'pointer';
106
-        button.draggable = false;
107 111
 
108 112
         icon.src = BUTTON_ICON_OFF;
109 113
         icon.draggable = false;
110
-        icon.style.display = 'inline';
114
+        icon.style.display = 'inline-block';
111 115
         icon.style.width = '100%';
112 116
         icon.style.height = '100%';
113 117
         icon.style.imageRendering = 'pixelated';
@@ -115,17 +119,19 @@ export class FullscreenButton
115 119
 
116 120
         const highlight = () => {
117 121
             button.style.backgroundColor = '#ffd500';
118
-            button.style.borderColor = '#bb9100';
122
+            button.style.borderColor = '#ffd500';
123
+            button.style.opacity = '1.0';
119 124
         };
120 125
 
121 126
         const dehighlight = () => {
122
-            button.style.backgroundColor = '#7e56c2';
123
-            button.style.borderColor = '#5c3ba3';
127
+            button.style.backgroundColor = 'transparent';
128
+            button.style.borderColor = 'white';
129
+            button.style.opacity = '0.5';
124 130
         };
125 131
 
126 132
         button.addEventListener('pointerdown', highlight);
127 133
         button.addEventListener('pointerup', dehighlight);
128
-        button.addEventListener('pointermove', dehighlight);
134
+        button.addEventListener('pointerleave', dehighlight);
129 135
 
130 136
         button.addEventListener('click', () => {
131 137
             if(!this._viewport.fullscreen) {

正在加载...
取消
保存