@@ -125,8 +125,8 @@ export class MenuController {
125
125
* @return {Promise } returns a promise when the menu is fully opened
126
126
*/
127
127
open ( menuId ?: string ) : Promise < boolean > {
128
- let menu = this . get ( menuId ) ;
129
- if ( menu ) {
128
+ const menu = this . get ( menuId ) ;
129
+ if ( menu && ! this . isAnimating ( ) ) {
130
130
let openedMenu = this . getOpen ( ) ;
131
131
if ( openedMenu && menu !== openedMenu ) {
132
132
openedMenu . setOpen ( false , false ) ;
@@ -171,9 +171,9 @@ export class MenuController {
171
171
* @return {Promise } returns a promise when the menu has been toggled
172
172
*/
173
173
toggle ( menuId ?: string ) : Promise < boolean > {
174
- let menu = this . get ( menuId ) ;
175
- if ( menu ) {
176
- let openedMenu = this . getOpen ( ) ;
174
+ const menu = this . get ( menuId ) ;
175
+ if ( menu && ! this . isAnimating ( ) ) {
176
+ var openedMenu = this . getOpen ( ) ;
177
177
if ( openedMenu && menu !== openedMenu ) {
178
178
openedMenu . setOpen ( false , false ) ;
179
179
}
@@ -191,7 +191,7 @@ export class MenuController {
191
191
* @return {Menu } Returns the instance of the menu, which is useful for chaining.
192
192
*/
193
193
enable ( shouldEnable : boolean , menuId ?: string ) : Menu {
194
- let menu = this . get ( menuId ) ;
194
+ const menu = this . get ( menuId ) ;
195
195
if ( menu ) {
196
196
return menu . enable ( shouldEnable ) ;
197
197
}
@@ -204,7 +204,7 @@ export class MenuController {
204
204
* @return {Menu } Returns the instance of the menu, which is useful for chaining.
205
205
*/
206
206
swipeEnable ( shouldEnable : boolean , menuId ?: string ) : Menu {
207
- let menu = this . get ( menuId ) ;
207
+ const menu = this . get ( menuId ) ;
208
208
if ( menu ) {
209
209
return menu . swipeEnable ( shouldEnable ) ;
210
210
}
@@ -229,7 +229,7 @@ export class MenuController {
229
229
* @return {boolean } Returns true if the menu is currently enabled, otherwise false.
230
230
*/
231
231
isEnabled ( menuId ?: string ) : boolean {
232
- let menu = this . get ( menuId ) ;
232
+ const menu = this . get ( menuId ) ;
233
233
return menu && menu . enabled || false ;
234
234
}
235
235
@@ -278,14 +278,21 @@ export class MenuController {
278
278
return this . _menus . find ( m => m . isOpen ) ;
279
279
}
280
280
281
-
282
281
/**
283
282
* @return {Array<Menu> } Returns an array of all menu instances.
284
283
*/
285
284
getMenus ( ) : Array < Menu > {
286
285
return this . _menus ;
287
286
}
288
287
288
+ /**
289
+ * @private
290
+ * @return {boolean } if any menu is currently animating
291
+ */
292
+ isAnimating ( ) : boolean {
293
+ return this . _menus . some ( menu => menu . isAnimating ( ) ) ;
294
+ }
295
+
289
296
/**
290
297
* @private
291
298
*/
0 commit comments