使用模态对话框主要是吞噬点击事件,让点击不会透传导底部,新建窗口都继承自模态对话框,也可以创建子类便于实现打开和关闭的动画效果

/*** Created by shake on 16/4/7.*/
"use strict";var ModalDialogLayer = cc.Layer.extend({m_touchListener:null,ctor:function(){this._super();var touchListener = {event: cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches: true,onTouchBegan: this.onTouchBegan};cc.eventManager.addListener(touchListener, this);this.m_touchListener = touchListener;},isTouchInside: function (owner, touch) {if(!owner || !owner.getParent()){return false;}var touchLocation = touch.getLocation();touchLocation = owner.getParent().convertToNodeSpace(touchLocation);return cc.rectContainsPoint(owner.getBoundingBox(), touchLocation);},onTouchBegan: function (touch, event) {var target = event.getCurrentTarget();// if(!target.isVisible() || (!this.isTouchInside(target,touch))){if(!target.isVisible() ){return false;}return true;},
});module.exports = ModalDialogLayer;

Cocosd2d-js 实现模态对话框相关推荐

  1. antd vue关闭模态对话框_如何在Bootstrap项目中用Vue.js替代jQuery

    Bootstrap是 Web 开发最受欢迎的框架之一,没有比它开发响应式网站项目效率最高了. 随着Vue.js的逐渐流行,更多人们用它来控制页面元素,实现强大互动功能.而jQuery出现了一些技术落后 ...

  2. 原生js——四种对话框

    js一共提供了四种对话弹框,即alert().confirm().prompt().showModalDialog().具体使用方法如下: 1.alert() alert()向用户显示一条消息并等待用 ...

  3. 使用javascript打开模态对话框

    1. 标准的方法 <script type="text/javascript">   function openWin(src, width, height, show ...

  4. 手机网页里的模态对话框

    今日帮朋友写了一个手机网页里用的模态对话框,防止自己日后忘记,所以mark一下.原理很简单,当弹出了模态对话框的时候,就是touchmove事件进行监听,如果是对话框的touchmove事件,就允许拖 ...

  5. showModalDialog模态对话框 的使用及一般问题的解决

    showModalDialog模态对话框 的使用及一般问题的解决 1,使用 showModalDialog(sURL [, oArguments] [,sFeatures]) 参数 : sURL : ...

  6. jQuery查找标签--选择器,筛选器,模态对话框, 左侧菜单栏

    查找标签 选择器: 基本选择器(同css) id选择器 $("#id")标签选择器 $('tagName')class选择器 $(".className")配合 ...

  7. Bootstrap3 静态模态对话框

    模态对话框 JavaScript内置了 3 种对话框:alert().prompt().confirm().alert() 只是一个简单的提示对话框,prompt() 可以接受用户输入的信息,conf ...

  8. Bootstrap 模态对话框

    模态对话框 JavaScript内置了 3 种对话框:alert().prompt().confirm().alert() 只是一个简单的提示对话框,prompt() 可以接受用户输入的信息,conf ...

  9. showModalDialog模态对话框的使用以及浏览器兼容

    ModalDialog 是什么? showModalDialog 是js window对象的一个方法, 和window.open一样都是打开一个新的页面. 区别是: showModalDialog打开 ...

  10. js“弹出对话框”和“弹出窗口”详解

    JS中showModalDialog 详细使用 基本介绍:           showModalDialog()         (IE 4+ 支持)           showModelessD ...

最新文章

  1. matlab length_《Matlab - Robotics System Toolbox》学习笔记(2)
  2. PHP文件上传主要代码讲解
  3. UVa 11059 - Maximum Product
  4. [转载]2000/XP下删除隐藏旧网卡方法
  5. python发展前景怎么样-python发展前景怎么样
  6. C# 如何生成一个时间戳
  7. AlphaGo:人工智能与深度学习
  8. 剑指Offer - 面试题57 - II. 和为s的连续正数序列(滑动窗口)
  9. CodeForces 1065E. Side Transmutations 计数
  10. SAS之COMPBL、DEQUOTE函数
  11. BSCI—7:OSPF的路由汇总
  12. JavaScript 学习计划
  13. python class是什么_python中什么是类
  14. XML文件的操作--上
  15. git 设置单个文件上传大小
  16. Blender图解教程:用权重传递(Transfer Weights)快速给动画角色穿衣服
  17. 查询服务器外网IP和根据域名查询外网IP
  18. python手机触屏代码_使用python实现触摸?
  19. python 股票交易接口 github_GitHub - gusihao/vnpy: 基于python的开源交易平台开发框架...
  20. SQL——行转列,列转行

热门文章

  1. vw 前端_px转vw和vh的工具(对前端同学有用)
  2. jQuery元素列表遍历方法
  3. 【GAOPS002】round robin Verilog实现
  4. 诺奖罗杰.彭罗斯的量子意识及其他(含朱清时-科学与佛学 77分钟视频)
  5. 毕业设计之企业网站后台管理的设想
  6. 由2022的数学奥林匹克竞赛(IMO)说起
  7. shell 三目运算符(条件运算符)
  8. JFinal AOP与Enhancer
  9. 前端常用的几种加密方法
  10. 览沃livox_大疆内部孵化的览沃科技Livox推出激光雷达,进入自动驾驶领域