@@ -8,6 +8,7 @@ import anim from "animejs";
8
8
} ;
9
9
10
10
export class FloatingActionButton extends Component {
11
+ el : HTMLElement ;
11
12
isOpen : boolean ;
12
13
private _anchor : HTMLAnchorElement ;
13
14
private _menu : HTMLElement | null ;
@@ -164,17 +165,18 @@ import anim from "animejs";
164
165
} ) ;
165
166
}
166
167
167
- // Not working for now... => No Material Specs. Is this even used? Remove?
168
-
169
168
_animateInToolbar ( ) {
170
- /*
171
169
let scaleFactor ;
172
170
let windowWidth = window . innerWidth ;
173
171
let windowHeight = window . innerHeight ;
174
172
let btnRect = this . el . getBoundingClientRect ( ) ;
175
- let backdrop = null; // $('<div class="fab-backdrop"></div>');
176
- //let fabColor = this.$anchor.css('background-color');
177
- this.$anchor.append(backdrop);
173
+
174
+ const backdrop = document . createElement ( 'div' ) ;
175
+ backdrop . classList . add ( 'fab-backdrop' ) ; // $('<div class="fab-backdrop"></div>');
176
+
177
+ const fabColor = getComputedStyle ( this . _anchor ) . backgroundColor ; // css('background-color');
178
+
179
+ this . _anchor . append ( backdrop ) ;
178
180
179
181
this . offsetX = btnRect . left - windowWidth / 2 + btnRect . width / 2 ;
180
182
this . offsetY = windowHeight - btnRect . bottom ;
@@ -184,64 +186,47 @@ import anim from "animejs";
184
186
this . btnWidth = btnRect . width ;
185
187
186
188
// Set initial state
187
- this.$el.addClass('active');
188
- this.$el.css({
189
- 'text-align': 'center',
190
- width: '100%',
191
- bottom: 0,
192
- left: 0,
193
- transform: 'translateX(' + this.offsetX + 'px)',
194
- transition: 'none'
195
- });
196
- this.$anchor.setAttribute('style', `
197
- transform: 'translateY(${this.offsetY}px)',
198
- transition: 'none'
199
- `);
189
+ this . el . classList . add ( 'active' ) ;
190
+ this . el . style . textAlign = 'center' ;
191
+ this . el . style . width = '100%' ;
192
+ this . el . style . bottom = '0' ;
193
+ this . el . style . left = '0' ;
194
+ this . el . style . transform = 'translateX(' + this . offsetX + 'px)' ;
195
+ this . el . style . transition = 'none' ;
200
196
201
- backdrop.css({
202
- 'background-color': fabColor
203
- });
197
+ this . _anchor . style . transform = `translateY(${ this . offsetY } px` ;
198
+ this . _anchor . style . transition = 'none' ;
204
199
205
- setTimeout(() => {
200
+ ( < HTMLElement > backdrop ) . style . backgroundColor = fabColor ;
206
201
207
- this.$el.css({
208
- transform: '',
209
- transition:
210
- 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
211
- });
202
+ setTimeout ( ( ) => {
203
+ this . el . style . transform = '' ;
204
+ this . el . style . transition = 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s' ;
212
205
213
- // this.$anchor.css({
214
- // overflow: 'visible',
215
- // transform: '',
216
- // transition: 'transform .2s'
217
- // });
206
+ this . _anchor . style . overflow = 'visible' ;
207
+ this . _anchor . style . transform = '' ;
208
+ this . _anchor . style . transition = 'transform .2s' ;
218
209
219
210
setTimeout ( ( ) => {
220
- this.$el.css({
221
- overflow: 'hidden',
222
- 'background-color': fabColor
223
- });
224
- backdrop.css({
225
- transform: 'scale(' + scaleFactor + ')',
226
- transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
227
- });
211
+ this . el . style . overflow = 'hidden' ;
212
+ this . el . style . backgroundColor = fabColor ;
213
+
214
+ backdrop . style . transform = 'scale(' + scaleFactor + ')' ;
215
+ backdrop . style . transition = 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)' ;
228
216
229
- // this.$menu
230
- // .children('li')
231
- // .children('a')
232
- // .css({
233
- // opacity: 1
234
- // });
217
+ this . _menu . querySelectorAll ( 'li > a' ) . forEach ( ( a : HTMLAnchorElement ) => a . style . opacity = '1' ) ;
235
218
236
219
// Scroll to close.
237
220
this . _handleDocumentClickBound = this . _handleDocumentClick . bind ( this ) ;
238
221
window . addEventListener ( 'scroll' , this . _handleCloseBound , true ) ;
239
222
document . body . addEventListener ( 'click' , this . _handleDocumentClickBound , true ) ;
240
223
} , 100 ) ;
241
224
} , 0 ) ;
242
- */
243
225
}
244
226
227
+
228
+
229
+
245
230
_animateOutToolbar ( ) {
246
231
return ;
247
232
/*
0 commit comments