File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -3,19 +3,19 @@ import { setCssVar } from "@@/utils/css"
3
3
4
4
const isDark = ref < boolean > ( getIsDark ( ) === "true" )
5
5
6
+ function _handler ( ) {
7
+ isDark . value = ! isDark . value
8
+ }
9
+
6
10
function changeDark ( { clientX, clientY } : MouseEvent ) {
7
11
const maxRadius = Math . hypot (
8
12
Math . max ( clientX , window . innerWidth - clientX ) ,
9
13
Math . max ( clientY , window . innerHeight - clientY )
10
14
)
11
- const documentElement = document . documentElement
12
- setCssVar ( "--mobvue-dark-x" , `${ clientX } px` , documentElement )
13
- setCssVar ( "--mobvue-dark-y" , `${ clientY } px` , documentElement )
14
- setCssVar ( "--mobvue-dark-r" , `${ maxRadius } px` , documentElement )
15
- const handler = ( ) => {
16
- isDark . value = ! isDark . value
17
- }
18
- document . startViewTransition ? document . startViewTransition ( handler ) : handler ( )
15
+ setCssVar ( "--mobvue-dark-x" , `${ clientX } px` )
16
+ setCssVar ( "--mobvue-dark-y" , `${ clientY } px` )
17
+ setCssVar ( "--mobvue-dark-r" , `${ maxRadius } px` )
18
+ document . startViewTransition ? document . startViewTransition ( _handler ) : _handler ( )
19
19
}
20
20
21
21
/** 初始化 */
You can’t perform that action at this time.
0 commit comments