File: ui/LMultitouch.js
/** @language english
* The LMultitouch class manages and provides information about the current environment's support for handling contact from user input devices, including contact that has two or more touch points (such as a user's fingers on a touch screen). When a user interacts with a device such as a mobile phone or tablet with a touch screen, the user typically touches the screen with his or her fingers or a pointing device. While there is a broad range of pointing devices, such as a mouse or a stylus, many of these devices only have a single point of contact with an application. For pointing devices with a single point of contact, user interaction events can be handled as a mouse event, or using a basic set of touch events (called "touch point" events).
* @class LMultitouch
* @constructor
* @since 1.8.9
* LInit(1000/50,"legend",800,450,main);
* var layer,backLayer,touchPointIDList = [];
* function main () {
* if(LGlobal.canTouch){
* LGlobal.stageScale = LStageScaleMode.EXACT_FIT;
* LSystem.screen(LStage.FULL_SCREEN);
* }
* LMultitouch.inputMode = LMultitouchInputMode.TOUCH_POINT;
* layer = new LSprite();
* layer.graphics.drawRect(2,"#ffffff",[0,0,LGlobal.width,LGlobal.height],true,"#ffffff");
* addChild(layer);
* backLayer = new LSprite();
* backLayer.y = 50;
* layer.addChild(backLayer);
* var txtLabel = new LTextField();
* txtLabel.size = 18;
* txtLabel.x = 10;
* txtLabel.y = 5;
* layer.addChild(txtLabel);
* if(!LGlobal.canTouch){
* txtLabel.text = "多点触屏测试:请用手机或平板电脑测试";
* }else{
* txtLabel.text = "多点触屏测试:请点击屏幕进行测试";
* }
* layer.addEventListener(LMouseEvent.MOUSE_DOWN,addTouchPointID);
* layer.addEventListener(LMouseEvent.MOUSE_MOVE,addTouchPointID);
* layer.addEventListener(LMouseEvent.MOUSE_UP,removeTouchPointID);
* }
* function addTouchPointID(e){
* var f = false;
* for(var i=0;i<touchPointIDList.length;i++){
* if(touchPointIDList[i].touchPointID == e.touchPointID){
* touchPointIDList[i] = e;
* f = true;
* break;
* }
* }
* if(!f)touchPointIDList.push(e);
* draw();
* }
* function removeTouchPointID(e){
* for(var i=0;i<touchPointIDList.length;i++){
* if(touchPointIDList[i].touchPointID == e.touchPointID){
* touchPointIDList.splice(i,1);
* break;
* }
* }
* draw();
* }
* function draw(){
* backLayer.removeAllChild();
* for(var i=0;i<touchPointIDList.length;i++){
* var eve = touchPointIDList[i];
* var title = new LTextField();
* title.text = "id:"+eve.touchPointID+","+eve.offsetX+","+eve.offsetY;
* title.size = 18;
* title.x = 10;
* title.y = i*23;
* backLayer.addChild(title);
* }
* }
* @examplelink <p><a href="../../../api/LMultitouch/index.html" target="_blank">Try it »</a></p>
* @public
*/
var LMultitouch = function () {throw "LMultitouch cannot be instantiated";};
/** @language english
* Identifies the multi-touch mode for touch and gesture event handling. To set this property, use values from the LMultitouchInputMode class.
* @property inputMode
* @type String
* @default none
* @since 1.8.9
* @public
*/
LMultitouch.inputMode = "none";
LMultitouch.touchs = [];