File tree 3 files changed +51
-17
lines changed
3 files changed +51
-17
lines changed Original file line number Diff line number Diff line change 644
644
.base-accordion
645
645
& > .content
646
646
@extend .no-padding , .main-bottom-section
647
+
648
+ .base-ticker-container
649
+ .ticker
650
+ will-change : transform
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
- class =" white-space-no-wrap"
3
+ class =" white-space-no-wrap base-ticker-container "
4
4
@mouseenter =" handleMouseEnter"
5
5
@mouseleave =" handleMouseLeave"
6
6
>
18
18
<script >
19
19
export default {
20
20
name: ' BaseTickerContainer' ,
21
+ props: {
22
+ isEnabled: {
23
+ type: Boolean ,
24
+ default: true
25
+ }
26
+ },
21
27
data () {
22
28
return {
23
29
content: null ,
@@ -65,16 +71,18 @@ export default {
65
71
} = this .$refs
66
72
67
73
this .ticker = ticker
74
+
68
75
this .content = content
69
76
70
77
this .setContentPaddingRight (
71
78
this .gapWidth
72
79
)
73
80
74
81
if (this .isTickable ) {
75
- this .ticker .appendChild (
76
- this .contentClone
77
- )
82
+ this .ticker
83
+ .appendChild (
84
+ this .contentClone
85
+ )
78
86
} else {
79
87
this .setContentPaddingRight (
80
88
0
@@ -83,27 +91,38 @@ export default {
83
91
},
84
92
methods: {
85
93
handleMouseEnter () {
86
- if (this .isTickable ) {
87
- this .speed = (
88
- this .speedPixels / 60
89
- )
94
+ if (! this .isEnabled ) { return }
90
95
91
- this .animate ()
92
- }
96
+ this .activate ()
93
97
},
94
98
handleMouseLeave () {
99
+ if (! this .isEnabled ) { return }
100
+
101
+ this .deactivate ()
102
+ },
103
+ handleRequestAnimationFrame () {
104
+ this .animate ()
105
+ },
106
+ activate () {
107
+ if (! this .isTickable ) { return }
108
+
109
+ this .speed = (
110
+ this .speedPixels / 60
111
+ )
112
+
113
+ this .animate ()
114
+ },
115
+ deactivate () {
95
116
cancelAnimationFrame (
96
117
this .animationFrame
97
118
)
98
119
99
120
this .progress = 0
121
+
100
122
this .speed = 0
101
123
102
124
this .transformTicker ()
103
125
},
104
- handleRequestAnimationFrame () {
105
- this .animate ()
106
- },
107
126
animate () {
108
127
this .progress -= this .speed
109
128
@@ -135,7 +154,4 @@ export default {
135
154
}
136
155
< / script>
137
156
138
- < style lang= " sass" scoped>
139
- .ticker
140
- will- change: transform
141
- < / style>
157
+ < style lang= " sass" scoped>< / style>
Original file line number Diff line number Diff line change 8
8
:is-invertable =" !isActive"
9
9
@click =" handleClick"
10
10
@auxclick.stop =" handleAuxClick"
11
+ @mouseenter =" handleMouseEnter"
12
+ @mouseleave =" handleMouseLeave"
11
13
>
12
14
<BaseIcon
13
15
class =" main-right-extrasmall-icon main-left-small-icon"
17
19
/>
18
20
19
21
<BaseTickerContainer
22
+ ref =" ticker"
20
23
:key =" key"
21
24
class =" tab-name text-overflow-hidden"
22
25
:class =" {
23
26
active: isActive
24
27
}"
28
+ :is-enabled =" false"
25
29
>
26
30
{{ tabTitle }}
27
31
</BaseTickerContainer >
@@ -154,6 +158,16 @@ export default {
154
158
this .callTabClose ()
155
159
}
156
160
},
161
+ handleMouseEnter () {
162
+ this .$refs
163
+ .ticker
164
+ .activate ()
165
+ },
166
+ handleMouseLeave () {
167
+ this .$refs
168
+ .ticker
169
+ .deactivate ()
170
+ },
157
171
callTabClose () {
158
172
window
159
173
.mainProcess
You can’t perform that action at this time.
0 commit comments