Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class Menu{
- private static menu;
- private static detailsMenuContainer;
- private static state :boolean = false;
- constructor(){
- Menu.menu = $(MENU);
- Menu.detailsMenuContainer = $(DETAILS_MENU_CONTAINER);
- fn.setOnDocumentListener('mousemove',MENU_EVENT_NAME,null,this.mousePosChecker);
- }
- public static showMenu(){
- Menu.state = true;
- Menu.menu.prop('class',ACTIVE_MENU_STATE_CLASS);
- Menu.detailsMenuContainer.prop('class',ACTIVE_MENU_STATE_CLASS);
- }
- public static hideMenu(){
- Menu.state = false;
- Menu.menu.prop('class',INACTIVE_MENU_STATE_CLASS);
- Menu.detailsMenuContainer.prop('class',INACTIVE_MENU_STATE_CLASS);
- }
- private mousePosChecker(e){
- let posX = e.clientX, posY = e.clientY, controlStateSize = CONTROL_STATE_INACTIVE;
- if(Menu.state) controlStateSize = CONTROL_STATE_ACTIVE;
- if(posY > CONTROL_TOP_STATE && posX < controlStateSize && !Menu.state){
- Menu.showMenu();
- }else if((posY < CONTROL_TOP_STATE || posX > controlStateSize) && Menu.state){
- Menu.hideMenu();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement