Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a14adc90
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a14adc90
编写于
2月 01, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some vs/base/browser linting
上级
06c26d8f
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
417 addition
and
418 deletion
+417
-418
src/vs/base/browser/browser.ts
src/vs/base/browser/browser.ts
+29
-28
src/vs/base/browser/browserService.ts
src/vs/base/browser/browserService.ts
+15
-15
src/vs/base/browser/dnd.ts
src/vs/base/browser/dnd.ts
+2
-4
src/vs/base/browser/dom.ts
src/vs/base/browser/dom.ts
+237
-237
src/vs/base/browser/idleMonitor.ts
src/vs/base/browser/idleMonitor.ts
+28
-28
src/vs/base/browser/iframe.ts
src/vs/base/browser/iframe.ts
+17
-17
src/vs/base/browser/touch.ts
src/vs/base/browser/touch.ts
+89
-89
未找到文件。
src/vs/base/browser/browser.ts
浏览文件 @
a14adc90
...
@@ -12,13 +12,13 @@ interface ISafeWindow {
...
@@ -12,13 +12,13 @@ interface ISafeWindow {
}
}
interface
ISafeDocument
{
interface
ISafeDocument
{
URL
:
string
;
URL
:
string
;
createElement
(
tagName
:
'
div
'
):
HTMLDivElement
;
createElement
(
tagName
:
'
div
'
):
HTMLDivElement
;
createElement
(
tagName
:
string
):
HTMLElement
;
createElement
(
tagName
:
string
):
HTMLElement
;
}
}
interface
INavigator
{
interface
INavigator
{
userAgent
:
string
;
userAgent
:
string
;
}
}
interface
ILocation
{
interface
ILocation
{
...
@@ -26,18 +26,18 @@ interface ILocation {
...
@@ -26,18 +26,18 @@ interface ILocation {
}
}
interface
IGlobalScope
{
interface
IGlobalScope
{
window
:
ISafeWindow
;
window
:
ISafeWindow
;
navigator
:
INavigator
;
navigator
:
INavigator
;
parent
:
IGlobalScope
;
parent
:
IGlobalScope
;
document
:
ISafeDocument
;
document
:
ISafeDocument
;
history
:
{
history
:
{
pushState
:
any
pushState
:
any
};
};
isTest
:
boolean
;
isTest
:
boolean
;
location
:
ILocation
;
location
:
ILocation
;
}
}
var
globals
=
<
IGlobalScope
><
any
>
(
typeof
self
===
'
object
'
?
self
:
global
);
const
globals
=
<
IGlobalScope
><
any
>
(
typeof
self
===
'
object
'
?
self
:
global
);
// MAC:
// MAC:
// chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.100 Safari/535.2"
// chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.100 Safari/535.2"
...
@@ -53,8 +53,8 @@ var globals = <IGlobalScope><any> (typeof self === 'object' ? self : global);
...
@@ -53,8 +53,8 @@ var globals = <IGlobalScope><any> (typeof self === 'object' ? self : global);
// chrome: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
// chrome: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
// firefox: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0"
// firefox: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0"
var
userAgent
=
globals
.
navigator
?
globals
.
navigator
.
userAgent
:
''
;
const
userAgent
=
globals
.
navigator
?
globals
.
navigator
.
userAgent
:
''
;
var
isTest
=
!!
globals
.
isTest
;
const
isTest
=
!!
globals
.
isTest
;
// DOCUMENTED FOR FUTURE REFERENCE:
// DOCUMENTED FOR FUTURE REFERENCE:
// When running IE11 in IE10 document mode, the code below will identify the browser as being IE10,
// When running IE11 in IE10 document mode, the code below will identify the browser as being IE10,
...
@@ -77,6 +77,8 @@ export const canUseTranslate3d = !isIE9 && !isFirefox;
...
@@ -77,6 +77,8 @@ export const canUseTranslate3d = !isIE9 && !isFirefox;
export
const
enableEmptySelectionClipboard
=
isWebKit
;
export
const
enableEmptySelectionClipboard
=
isWebKit
;
let
_disablePushState
=
false
;
/**
/**
* Returns if the browser supports the history.pushState function or not.
* Returns if the browser supports the history.pushState function or not.
*/
*/
...
@@ -84,7 +86,6 @@ export function canPushState() {
...
@@ -84,7 +86,6 @@ export function canPushState() {
return
(
!
_disablePushState
&&
globals
.
history
&&
globals
.
history
.
pushState
);
return
(
!
_disablePushState
&&
globals
.
history
&&
globals
.
history
.
pushState
);
};
};
var
_disablePushState
=
false
;
/**
/**
* Helpful when we detect that pushing state does not work for some reason (e.g. FF prevents pushState for security reasons in some cases)
* Helpful when we detect that pushing state does not work for some reason (e.g. FF prevents pushState for security reasons in some cases)
*/
*/
...
@@ -104,11 +105,11 @@ export function hasCSSAnimationSupport() {
...
@@ -104,11 +105,11 @@ export function hasCSSAnimationSupport() {
return
false
;
return
false
;
}
}
var
supported
=
false
;
let
supported
=
false
;
var
element
=
globals
.
document
.
createElement
(
'
div
'
);
let
element
=
globals
.
document
.
createElement
(
'
div
'
);
var
properties
=
[
'
animationName
'
,
'
webkitAnimationName
'
,
'
msAnimationName
'
,
'
MozAnimationName
'
,
'
OAnimationName
'
];
let
properties
=
[
'
animationName
'
,
'
webkitAnimationName
'
,
'
msAnimationName
'
,
'
MozAnimationName
'
,
'
OAnimationName
'
];
for
(
var
i
=
0
;
i
<
properties
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
properties
.
length
;
i
++
)
{
var
property
=
properties
[
i
];
let
property
=
properties
[
i
];
if
(
!
types
.
isUndefinedOrNull
(
element
.
style
[
property
])
||
element
.
style
.
hasOwnProperty
(
property
))
{
if
(
!
types
.
isUndefinedOrNull
(
element
.
style
[
property
])
||
element
.
style
.
hasOwnProperty
(
property
))
{
supported
=
true
;
supported
=
true
;
break
;
break
;
...
@@ -127,14 +128,14 @@ export function hasCSSAnimationSupport() {
...
@@ -127,14 +128,14 @@ export function hasCSSAnimationSupport() {
/**
/**
* Returns if the browser supports the provided video mime type or not.
* Returns if the browser supports the provided video mime type or not.
*/
*/
export
function
canPlayVideo
(
type
:
string
)
{
export
function
canPlayVideo
(
type
:
string
)
{
if
(
!
globals
.
document
)
{
if
(
!
globals
.
document
)
{
return
false
;
return
false
;
}
}
var
video
:
HTMLVideoElement
=
<
HTMLVideoElement
>
globals
.
document
.
createElement
(
'
video
'
);
let
video
:
HTMLVideoElement
=
<
HTMLVideoElement
>
globals
.
document
.
createElement
(
'
video
'
);
if
(
video
.
canPlayType
)
{
if
(
video
.
canPlayType
)
{
var
canPlay
=
video
.
canPlayType
(
type
);
let
canPlay
=
video
.
canPlayType
(
type
);
return
canPlay
===
'
maybe
'
||
canPlay
===
'
probably
'
;
return
canPlay
===
'
maybe
'
||
canPlay
===
'
probably
'
;
}
}
...
@@ -145,14 +146,14 @@ export function canPlayVideo(type:string) {
...
@@ -145,14 +146,14 @@ export function canPlayVideo(type:string) {
/**
/**
* Returns if the browser supports the provided audio mime type or not.
* Returns if the browser supports the provided audio mime type or not.
*/
*/
export
function
canPlayAudio
(
type
:
string
)
{
export
function
canPlayAudio
(
type
:
string
)
{
if
(
!
globals
.
document
)
{
if
(
!
globals
.
document
)
{
return
false
;
return
false
;
}
}
var
audio
:
HTMLAudioElement
=
<
HTMLAudioElement
>
globals
.
document
.
createElement
(
'
audio
'
);
let
audio
:
HTMLAudioElement
=
<
HTMLAudioElement
>
globals
.
document
.
createElement
(
'
audio
'
);
if
(
audio
.
canPlayType
)
{
if
(
audio
.
canPlayType
)
{
var
canPlay
=
audio
.
canPlayType
(
type
);
let
canPlay
=
audio
.
canPlayType
(
type
);
return
canPlay
===
'
maybe
'
||
canPlay
===
'
probably
'
;
return
canPlay
===
'
maybe
'
||
canPlay
===
'
probably
'
;
}
}
...
@@ -160,11 +161,11 @@ export function canPlayAudio(type:string) {
...
@@ -160,11 +161,11 @@ export function canPlayAudio(type:string) {
return
false
;
return
false
;
}
}
export
function
isInWebWorker
():
boolean
{
export
function
isInWebWorker
():
boolean
{
return
!
globals
.
document
&&
typeof
((
<
any
>
globals
).
importScripts
)
!==
'
undefined
'
;
return
!
globals
.
document
&&
typeof
((
<
any
>
globals
).
importScripts
)
!==
'
undefined
'
;
}
}
export
function
supportsExecCommand
(
command
:
string
):
boolean
{
export
function
supportsExecCommand
(
command
:
string
):
boolean
{
return
(
return
(
(
isIE11orEarlier
||
Platform
.
isNative
)
(
isIE11orEarlier
||
Platform
.
isNative
)
&&
document
.
queryCommandSupported
(
command
)
&&
document
.
queryCommandSupported
(
command
)
...
...
src/vs/base/browser/browserService.ts
浏览文件 @
a14adc90
...
@@ -4,27 +4,27 @@
...
@@ -4,27 +4,27 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
'
use strict
'
;
import
Browser
=
require
(
'
vs/base/browser/browser
'
)
;
import
{
isInWebWorker
}
from
'
vs/base/browser/browser
'
;
export
interface
IBrowserServiceData
{
export
interface
IBrowserServiceData
{
document
:
Document
;
document
:
Document
;
window
:
Window
;
window
:
Window
;
isHTMLElement
:
(
o
:
any
)
=>
boolean
;
isHTMLElement
:
(
o
:
any
)
=>
boolean
;
}
}
export
interface
IBrowserService
extends
IBrowserServiceData
{
export
interface
IBrowserService
extends
IBrowserServiceData
{
/**
/**
* Mock the DOM with dummy objects
* Mock the DOM with dummy objects
*/
*/
mock
(
source
:
IBrowserServiceData
):
void
;
mock
(
source
:
IBrowserServiceData
):
void
;
/**
/**
* Restore the normal DOM
* Restore the normal DOM
*/
*/
restore
():
void
;
restore
():
void
;
}
}
export
function
regularIsHTMLElement
(
o
:
any
):
boolean
{
export
function
regularIsHTMLElement
(
o
:
any
):
boolean
{
if
(
typeof
HTMLElement
===
'
object
'
)
{
if
(
typeof
HTMLElement
===
'
object
'
)
{
return
o
instanceof
HTMLElement
;
return
o
instanceof
HTMLElement
;
}
}
...
@@ -33,23 +33,23 @@ export function regularIsHTMLElement(o:any): boolean {
...
@@ -33,23 +33,23 @@ export function regularIsHTMLElement(o:any): boolean {
class
BrowserService
implements
IBrowserService
{
class
BrowserService
implements
IBrowserService
{
public
document
:
Document
;
public
document
:
Document
;
public
window
:
Window
;
public
window
:
Window
;
public
isHTMLElement
:
(
o
:
any
)
=>
boolean
;
public
isHTMLElement
:
(
o
:
any
)
=>
boolean
;
constructor
()
{
constructor
()
{
this
.
restore
();
this
.
restore
();
}
}
public
mock
(
source
:
IBrowserServiceData
):
void
{
public
mock
(
source
:
IBrowserServiceData
):
void
{
this
.
document
=
source
.
document
;
this
.
document
=
source
.
document
;
this
.
window
=
source
.
window
;
this
.
window
=
source
.
window
;
this
.
isHTMLElement
=
source
.
isHTMLElement
;
this
.
isHTMLElement
=
source
.
isHTMLElement
;
}
}
public
restore
():
void
{
public
restore
():
void
{
this
.
isHTMLElement
=
regularIsHTMLElement
;
this
.
isHTMLElement
=
regularIsHTMLElement
;
if
(
Browser
.
isInWebWorker
())
{
if
(
isInWebWorker
())
{
this
.
document
=
null
;
this
.
document
=
null
;
this
.
window
=
null
;
this
.
window
=
null
;
}
else
{
}
else
{
...
@@ -59,8 +59,8 @@ class BrowserService implements IBrowserService {
...
@@ -59,8 +59,8 @@ class BrowserService implements IBrowserService {
}
}
}
}
var
browserService
=
new
BrowserService
();
const
browserService
=
new
BrowserService
();
export
function
getService
():
IBrowserService
{
export
function
getService
():
IBrowserService
{
return
browserService
;
return
browserService
;
}
}
\ No newline at end of file
src/vs/base/browser/dnd.ts
浏览文件 @
a14adc90
...
@@ -5,9 +5,7 @@
...
@@ -5,9 +5,7 @@
'
use strict
'
;
'
use strict
'
;
import
Builder
=
require
(
'
vs/base/browser/builder
'
);
import
{
$
}
from
'
vs/base/browser/builder
'
;
var
$
=
Builder
.
$
;
/**
/**
* A helper that will execute a provided function when the provided HTMLElement receives
* A helper that will execute a provided function when the provided HTMLElement receives
...
@@ -17,7 +15,7 @@ export class DelayedDragHandler {
...
@@ -17,7 +15,7 @@ export class DelayedDragHandler {
private
timeout
:
number
;
private
timeout
:
number
;
constructor
(
container
:
HTMLElement
,
callback
:
()
=>
void
)
{
constructor
(
container
:
HTMLElement
,
callback
:
()
=>
void
)
{
$
(
container
).
on
(
'
dragover
'
,
()
=>
{
$
(
container
).
on
(
'
dragover
'
,
()
=>
{
if
(
!
this
.
timeout
)
{
if
(
!
this
.
timeout
)
{
this
.
timeout
=
setTimeout
(()
=>
{
this
.
timeout
=
setTimeout
(()
=>
{
...
...
src/vs/base/browser/dom.ts
浏览文件 @
a14adc90
此差异已折叠。
点击以展开。
src/vs/base/browser/idleMonitor.ts
浏览文件 @
a14adc90
...
@@ -5,28 +5,28 @@
...
@@ -5,28 +5,28 @@
'
use strict
'
;
'
use strict
'
;
import
DomUtils
=
require
(
'
vs/base/browser/dom
'
);
import
DomUtils
=
require
(
'
vs/base/browser/dom
'
);
import
Lifecycle
=
require
(
'
vs/base/common/lifecycle
'
)
;
import
{
IDisposable
,
disposeAll
}
from
'
vs/base/common/lifecycle
'
;
import
EventEmitter
=
require
(
'
vs/base/common/eventEmitter
'
)
;
import
{
EventEmitter
,
ListenerUnbind
}
from
'
vs/base/common/eventEmitter
'
;
import
BrowserService
=
require
(
'
vs/base/browser/browserService
'
)
;
import
{
getService
}
from
'
vs/base/browser/browserService
'
;
export
enum
UserStatus
{
export
enum
UserStatus
{
Idle
,
Idle
,
Active
Active
}
}
export
var
DEFAULT_IDLE_TIME
=
60
*
60
*
1000
;
// 60 minutes
export
const
DEFAULT_IDLE_TIME
=
60
*
60
*
1000
;
// 60 minutes
export
class
IdleMonitor
{
export
class
IdleMonitor
{
private
toDispose
:
Lifecycle
.
IDisposable
[];
private
toDispose
:
IDisposable
[];
private
lastActiveTime
:
number
;
private
lastActiveTime
:
number
;
private
idleCheckTimeout
:
number
;
private
idleCheckTimeout
:
number
;
private
status
:
UserStatus
;
private
status
:
UserStatus
;
private
eventEmitter
:
EventEmitter
.
EventEmitter
;
private
eventEmitter
:
EventEmitter
;
private
instance
:
ReferenceCountedIdleMonitor
;
private
instance
:
ReferenceCountedIdleMonitor
;
private
idleTime
:
number
;
private
idleTime
:
number
;
constructor
(
idleTime
:
number
=
DEFAULT_IDLE_TIME
)
{
constructor
(
idleTime
:
number
=
DEFAULT_IDLE_TIME
)
{
this
.
instance
=
ReferenceCountedIdleMonitor
.
INSTANCE
;
this
.
instance
=
ReferenceCountedIdleMonitor
.
INSTANCE
;
this
.
instance
.
increment
();
this
.
instance
.
increment
();
...
@@ -36,17 +36,17 @@ export class IdleMonitor {
...
@@ -36,17 +36,17 @@ export class IdleMonitor {
this
.
idleTime
=
idleTime
;
this
.
idleTime
=
idleTime
;
this
.
toDispose
=
[];
this
.
toDispose
=
[];
this
.
eventEmitter
=
new
EventEmitter
.
EventEmitter
();
this
.
eventEmitter
=
new
EventEmitter
();
this
.
toDispose
.
push
(
this
.
eventEmitter
);
this
.
toDispose
.
push
(
this
.
eventEmitter
);
this
.
toDispose
.
push
({
dispose
:
this
.
instance
.
addListener
(()
=>
this
.
onUserActive
())
});
this
.
toDispose
.
push
({
dispose
:
this
.
instance
.
addListener
(()
=>
this
.
onUserActive
())
});
this
.
onUserActive
();
this
.
onUserActive
();
}
}
public
addOneTimeActiveListener
(
callback
:
()
=>
void
):
Lifecycle
.
IDisposable
{
public
addOneTimeActiveListener
(
callback
:
()
=>
void
):
IDisposable
{
return
this
.
eventEmitter
.
addOneTimeDisposableListener
(
'
onActive
'
,
callback
);
return
this
.
eventEmitter
.
addOneTimeDisposableListener
(
'
onActive
'
,
callback
);
}
}
public
addOneTimeIdleListener
(
callback
:
()
=>
void
):
Lifecycle
.
IDisposable
{
public
addOneTimeIdleListener
(
callback
:
()
=>
void
):
IDisposable
{
return
this
.
eventEmitter
.
addOneTimeDisposableListener
(
'
onIdle
'
,
callback
);
return
this
.
eventEmitter
.
addOneTimeDisposableListener
(
'
onIdle
'
,
callback
);
}
}
...
@@ -56,7 +56,7 @@ export class IdleMonitor {
...
@@ -56,7 +56,7 @@ export class IdleMonitor {
public
dispose
():
void
{
public
dispose
():
void
{
this
.
cancelIdleCheck
();
this
.
cancelIdleCheck
();
this
.
toDispose
=
Lifecycle
.
disposeAll
(
this
.
toDispose
);
this
.
toDispose
=
disposeAll
(
this
.
toDispose
);
this
.
instance
.
decrement
();
this
.
instance
.
decrement
();
}
}
...
@@ -78,7 +78,7 @@ export class IdleMonitor {
...
@@ -78,7 +78,7 @@ export class IdleMonitor {
private
scheduleIdleCheck
():
void
{
private
scheduleIdleCheck
():
void
{
if
(
this
.
idleCheckTimeout
===
-
1
)
{
if
(
this
.
idleCheckTimeout
===
-
1
)
{
var
minimumTimeWhenUserCanBecomeIdle
=
this
.
lastActiveTime
+
this
.
idleTime
;
let
minimumTimeWhenUserCanBecomeIdle
=
this
.
lastActiveTime
+
this
.
idleTime
;
this
.
idleCheckTimeout
=
setTimeout
(()
=>
{
this
.
idleCheckTimeout
=
setTimeout
(()
=>
{
this
.
idleCheckTimeout
=
-
1
;
this
.
idleCheckTimeout
=
-
1
;
this
.
checkIfUserIsIdle
();
this
.
checkIfUserIsIdle
();
...
@@ -94,7 +94,7 @@ export class IdleMonitor {
...
@@ -94,7 +94,7 @@ export class IdleMonitor {
}
}
private
checkIfUserIsIdle
():
void
{
private
checkIfUserIsIdle
():
void
{
var
actualIdleTime
=
(
new
Date
()).
getTime
()
-
this
.
lastActiveTime
;
let
actualIdleTime
=
(
new
Date
()).
getTime
()
-
this
.
lastActiveTime
;
if
(
actualIdleTime
>=
this
.
idleTime
)
{
if
(
actualIdleTime
>=
this
.
idleTime
)
{
this
.
onUserIdle
();
this
.
onUserIdle
();
}
else
{
}
else
{
...
@@ -105,7 +105,7 @@ export class IdleMonitor {
...
@@ -105,7 +105,7 @@ export class IdleMonitor {
class
ReferenceCountedObject
{
class
ReferenceCountedObject
{
private
referenceCount
:
number
;
private
referenceCount
:
number
;
constructor
()
{
constructor
()
{
this
.
referenceCount
=
0
;
this
.
referenceCount
=
0
;
...
@@ -138,29 +138,29 @@ class ReferenceCountedObject {
...
@@ -138,29 +138,29 @@ class ReferenceCountedObject {
class
ReferenceCountedIdleMonitor
extends
ReferenceCountedObject
{
class
ReferenceCountedIdleMonitor
extends
ReferenceCountedObject
{
public
static
INSTANCE
:
ReferenceCountedIdleMonitor
=
new
ReferenceCountedIdleMonitor
();
public
static
INSTANCE
:
ReferenceCountedIdleMonitor
=
new
ReferenceCountedIdleMonitor
();
private
toDispose
:
Lifecycle
.
IDisposable
[];
private
toDispose
:
IDisposable
[];
private
eventEmitter
:
EventEmitter
.
EventEmitter
;
private
eventEmitter
:
EventEmitter
;
public
construct
():
void
{
public
construct
():
void
{
this
.
toDispose
=
[];
this
.
toDispose
=
[];
this
.
eventEmitter
=
new
EventEmitter
.
EventEmitter
();
this
.
eventEmitter
=
new
EventEmitter
();
this
.
toDispose
.
push
(
this
.
eventEmitter
);
this
.
toDispose
.
push
(
this
.
eventEmitter
);
this
.
toDispose
.
push
(
DomUtils
.
addDisposableListener
(
BrowserService
.
getService
().
document
,
'
mousemove
'
,
()
=>
this
.
onUserActive
()));
this
.
toDispose
.
push
(
DomUtils
.
addDisposableListener
(
getService
().
document
,
'
mousemove
'
,
()
=>
this
.
onUserActive
()));
this
.
toDispose
.
push
(
DomUtils
.
addDisposableListener
(
BrowserService
.
getService
().
document
,
'
keydown
'
,
()
=>
this
.
onUserActive
()));
this
.
toDispose
.
push
(
DomUtils
.
addDisposableListener
(
getService
().
document
,
'
keydown
'
,
()
=>
this
.
onUserActive
()));
this
.
onUserActive
();
this
.
onUserActive
();
}
}
public
dispose
():
void
{
public
dispose
():
void
{
this
.
toDispose
=
Lifecycle
.
disposeAll
(
this
.
toDispose
);
this
.
toDispose
=
disposeAll
(
this
.
toDispose
);
}
}
private
onUserActive
():
void
{
private
onUserActive
():
void
{
this
.
eventEmitter
.
emit
(
'
onActive
'
);
this
.
eventEmitter
.
emit
(
'
onActive
'
);
}
}
public
addListener
(
callback
:
()
=>
void
):
EventEmitter
.
ListenerUnbind
{
public
addListener
(
callback
:
()
=>
void
):
ListenerUnbind
{
return
this
.
eventEmitter
.
addListener
(
'
onActive
'
,
callback
);
return
this
.
eventEmitter
.
addListener
(
'
onActive
'
,
callback
);
}
}
}
}
\ No newline at end of file
src/vs/base/browser/iframe.ts
浏览文件 @
a14adc90
...
@@ -18,18 +18,18 @@ export interface IWindowChainElement {
...
@@ -18,18 +18,18 @@ export interface IWindowChainElement {
iframeElement
:
HTMLIFrameElement
;
iframeElement
:
HTMLIFrameElement
;
}
}
var
hasDifferentOriginAncestorFlag
:
boolean
=
false
;
let
hasDifferentOriginAncestorFlag
:
boolean
=
false
;
var
sameOriginWindowChainCache
:
IWindowChainElement
[]
=
null
;
let
sameOriginWindowChainCache
:
IWindowChainElement
[]
=
null
;
function
getParentWindowIfSameOrigin
(
w
:
Window
):
Window
{
function
getParentWindowIfSameOrigin
(
w
:
Window
):
Window
{
if
(
!
w
.
parent
||
w
.
parent
===
w
)
{
if
(
!
w
.
parent
||
w
.
parent
===
w
)
{
return
null
;
return
null
;
}
}
// Cannot really tell if we have access to the parent window unless we try to access something in it
// Cannot really tell if we have access to the parent window unless we try to access something in it
try
{
try
{
var
location
=
w
.
location
;
let
location
=
w
.
location
;
var
parentLocation
=
w
.
parent
.
location
;
let
parentLocation
=
w
.
parent
.
location
;
if
(
location
.
protocol
!==
parentLocation
.
protocol
||
location
.
hostname
!==
parentLocation
.
hostname
||
location
.
port
!==
parentLocation
.
port
)
{
if
(
location
.
protocol
!==
parentLocation
.
protocol
||
location
.
hostname
!==
parentLocation
.
hostname
||
location
.
port
!==
parentLocation
.
port
)
{
hasDifferentOriginAncestorFlag
=
true
;
hasDifferentOriginAncestorFlag
=
true
;
return
null
;
return
null
;
...
@@ -42,10 +42,10 @@ function getParentWindowIfSameOrigin(w:Window): Window {
...
@@ -42,10 +42,10 @@ function getParentWindowIfSameOrigin(w:Window): Window {
return
w
.
parent
;
return
w
.
parent
;
}
}
function
findIframeElementInParentWindow
(
parentWindow
:
Window
,
childWindow
:
Window
):
HTMLIFrameElement
{
function
findIframeElementInParentWindow
(
parentWindow
:
Window
,
childWindow
:
Window
):
HTMLIFrameElement
{
var
parentWindowIframes
=
parentWindow
.
document
.
getElementsByTagName
(
'
iframe
'
);
let
parentWindowIframes
=
parentWindow
.
document
.
getElementsByTagName
(
'
iframe
'
);
var
iframe
:
HTMLIFrameElement
;
let
iframe
:
HTMLIFrameElement
;
for
(
var
i
=
0
,
len
=
parentWindowIframes
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
parentWindowIframes
.
length
;
i
<
len
;
i
++
)
{
iframe
=
parentWindowIframes
[
i
];
iframe
=
parentWindowIframes
[
i
];
if
(
iframe
.
contentWindow
===
childWindow
)
{
if
(
iframe
.
contentWindow
===
childWindow
)
{
return
iframe
;
return
iframe
;
...
@@ -62,7 +62,7 @@ function findIframeElementInParentWindow(parentWindow:Window, childWindow:Window
...
@@ -62,7 +62,7 @@ function findIframeElementInParentWindow(parentWindow:Window, childWindow:Window
export
function
getSameOriginWindowChain
():
IWindowChainElement
[]
{
export
function
getSameOriginWindowChain
():
IWindowChainElement
[]
{
if
(
!
sameOriginWindowChainCache
)
{
if
(
!
sameOriginWindowChainCache
)
{
sameOriginWindowChainCache
=
[];
sameOriginWindowChainCache
=
[];
var
w
=
window
,
parent
:
Window
;
let
w
=
window
,
parent
:
Window
;
do
{
do
{
parent
=
getParentWindowIfSameOrigin
(
w
);
parent
=
getParentWindowIfSameOrigin
(
w
);
if
(
parent
)
{
if
(
parent
)
{
...
@@ -96,7 +96,7 @@ export function hasDifferentOriginAncestor(): boolean {
...
@@ -96,7 +96,7 @@ export function hasDifferentOriginAncestor(): boolean {
/**
/**
* Returns the position of `childWindow` relative to `ancestorWindow`
* Returns the position of `childWindow` relative to `ancestorWindow`
*/
*/
export
function
getPositionOfChildWindowRelativeToAncestorWindow
(
childWindow
:
Window
,
ancestorWindow
:
any
)
{
export
function
getPositionOfChildWindowRelativeToAncestorWindow
(
childWindow
:
Window
,
ancestorWindow
:
any
)
{
if
(
!
ancestorWindow
||
childWindow
===
ancestorWindow
)
{
if
(
!
ancestorWindow
||
childWindow
===
ancestorWindow
)
{
return
{
return
{
...
@@ -105,12 +105,12 @@ export function getPositionOfChildWindowRelativeToAncestorWindow(childWindow:Win
...
@@ -105,12 +105,12 @@ export function getPositionOfChildWindowRelativeToAncestorWindow(childWindow:Win
};
};
}
}
var
top
=
0
,
left
=
0
;
let
top
=
0
,
left
=
0
;
var
windowChain
=
getSameOriginWindowChain
();
let
windowChain
=
getSameOriginWindowChain
();
for
(
var
i
=
0
;
i
<
windowChain
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
windowChain
.
length
;
i
++
)
{
var
windowChainEl
=
windowChain
[
i
];
let
windowChainEl
=
windowChain
[
i
];
if
(
windowChainEl
.
window
===
ancestorWindow
)
{
if
(
windowChainEl
.
window
===
ancestorWindow
)
{
break
;
break
;
...
@@ -120,7 +120,7 @@ export function getPositionOfChildWindowRelativeToAncestorWindow(childWindow:Win
...
@@ -120,7 +120,7 @@ export function getPositionOfChildWindowRelativeToAncestorWindow(childWindow:Win
break
;
break
;
}
}
var
boundingRect
=
windowChainEl
.
iframeElement
.
getBoundingClientRect
();
let
boundingRect
=
windowChainEl
.
iframeElement
.
getBoundingClientRect
();
top
+=
boundingRect
.
top
;
top
+=
boundingRect
.
top
;
left
+=
boundingRect
.
left
;
left
+=
boundingRect
.
left
;
}
}
...
...
src/vs/base/browser/touch.ts
浏览文件 @
a14adc90
...
@@ -4,76 +4,76 @@
...
@@ -4,76 +4,76 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
'
use strict
'
;
import
A
rrays
=
require
(
'
vs/base/common/arrays
'
);
import
a
rrays
=
require
(
'
vs/base/common/arrays
'
);
import
Lifecycle
=
require
(
'
vs/base/common/lifecycle
'
)
;
import
{
IDisposable
,
cAll
}
from
'
vs/base/common/lifecycle
'
;
import
DomUtils
=
require
(
'
vs/base/browser/dom
'
);
import
DomUtils
=
require
(
'
vs/base/browser/dom
'
);
export
namespace
EventType
{
export
namespace
EventType
{
export
var
Tap
=
'
-monaco-gesturetap
'
;
export
const
Tap
=
'
-monaco-gesturetap
'
;
export
var
Change
=
'
-monaco-gesturechange
'
;
export
const
Change
=
'
-monaco-gesturechange
'
;
export
var
Start
=
'
-monaco-gesturestart
'
;
export
const
Start
=
'
-monaco-gesturestart
'
;
export
var
End
=
'
-monaco-gesturesend
'
;
export
const
End
=
'
-monaco-gesturesend
'
;
}
}
interface
TouchData
{
interface
TouchData
{
id
:
number
;
id
:
number
;
initialTarget
:
EventTarget
;
initialTarget
:
EventTarget
;
initialTimeStamp
:
number
;
initialTimeStamp
:
number
;
initialPageX
:
number
;
initialPageX
:
number
;
initialPageY
:
number
;
initialPageY
:
number
;
rollingTimestamps
:
number
[];
rollingTimestamps
:
number
[];
rollingPageX
:
number
[];
rollingPageX
:
number
[];
rollingPageY
:
number
[];
rollingPageY
:
number
[];
}
}
export
interface
GestureEvent
extends
MouseEvent
{
export
interface
GestureEvent
extends
MouseEvent
{
initialTarget
:
EventTarget
;
initialTarget
:
EventTarget
;
translationX
:
number
;
translationX
:
number
;
translationY
:
number
;
translationY
:
number
;
pageX
:
number
;
pageX
:
number
;
pageY
:
number
;
pageY
:
number
;
}
}
interface
Touch
{
interface
Touch
{
identifier
:
number
;
identifier
:
number
;
screenX
:
number
;
screenX
:
number
;
screenY
:
number
;
screenY
:
number
;
clientX
:
number
;
clientX
:
number
;
clientY
:
number
;
clientY
:
number
;
pageX
:
number
;
pageX
:
number
;
pageY
:
number
;
pageY
:
number
;
radiusX
:
number
;
radiusX
:
number
;
radiusY
:
number
;
radiusY
:
number
;
rotationAngle
:
number
;
rotationAngle
:
number
;
force
:
number
;
force
:
number
;
target
:
Element
;
target
:
Element
;
}
}
interface
TouchList
{
interface
TouchList
{
[
i
:
number
]:
Touch
;
[
i
:
number
]:
Touch
;
length
:
number
;
length
:
number
;
item
(
index
:
number
):
Touch
;
item
(
index
:
number
):
Touch
;
identifiedTouch
(
id
:
number
):
Touch
;
identifiedTouch
(
id
:
number
):
Touch
;
}
}
interface
TouchEvent
extends
Event
{
interface
TouchEvent
extends
Event
{
touches
:
TouchList
;
touches
:
TouchList
;
targetTouches
:
TouchList
;
targetTouches
:
TouchList
;
changedTouches
:
TouchList
;
changedTouches
:
TouchList
;
}
}
export
class
Gesture
implements
Lifecycle
.
IDisposable
{
export
class
Gesture
implements
IDisposable
{
private
static
HOLD_DELAY
=
2000
;
private
static
HOLD_DELAY
=
2000
;
private
static
SCROLL_FRICTION
=
-
0.005
;
private
static
SCROLL_FRICTION
=
-
0.005
;
private
targetElement
:
HTMLElement
;
private
targetElement
:
HTMLElement
;
private
callOnTarget
:
Function
[];
private
callOnTarget
:
Function
[];
private
handle
:
Lifecycle
.
IDisposable
;
private
handle
:
IDisposable
;
private
activeTouches
:
{[
id
:
number
]:
TouchData
;
};
private
activeTouches
:
{
[
id
:
number
]:
TouchData
;
};
constructor
(
target
:
HTMLElement
)
{
constructor
(
target
:
HTMLElement
)
{
this
.
callOnTarget
=
[];
this
.
callOnTarget
=
[];
this
.
activeTouches
=
{};
this
.
activeTouches
=
{};
this
.
target
=
target
;
this
.
target
=
target
;
...
@@ -88,14 +88,14 @@ export class Gesture implements Lifecycle.IDisposable {
...
@@ -88,14 +88,14 @@ export class Gesture implements Lifecycle.IDisposable {
}
}
}
}
public
set
target
(
element
:
HTMLElement
)
{
public
set
target
(
element
:
HTMLElement
)
{
Lifecycle
.
cAll
(
this
.
callOnTarget
);
cAll
(
this
.
callOnTarget
);
this
.
activeTouches
=
{};
this
.
activeTouches
=
{};
this
.
targetElement
=
element
;
this
.
targetElement
=
element
;
if
(
!
this
.
targetElement
)
{
if
(
!
this
.
targetElement
)
{
return
;
return
;
}
}
...
@@ -104,14 +104,14 @@ export class Gesture implements Lifecycle.IDisposable {
...
@@ -104,14 +104,14 @@ export class Gesture implements Lifecycle.IDisposable {
this
.
callOnTarget
.
push
(
DomUtils
.
addListener
(
this
.
targetElement
,
'
touchmove
'
,
(
e
)
=>
this
.
onTouchMove
(
e
)));
this
.
callOnTarget
.
push
(
DomUtils
.
addListener
(
this
.
targetElement
,
'
touchmove
'
,
(
e
)
=>
this
.
onTouchMove
(
e
)));
}
}
private
static
newGestureEvent
(
type
:
string
):
GestureEvent
{
private
static
newGestureEvent
(
type
:
string
):
GestureEvent
{
var
event
=
<
GestureEvent
>
(
<
any
>
document
.
createEvent
(
'
CustomEvent
'
));
let
event
=
<
GestureEvent
>
(
<
any
>
document
.
createEvent
(
'
CustomEvent
'
));
event
.
initEvent
(
type
,
false
,
true
);
event
.
initEvent
(
type
,
false
,
true
);
return
event
;
return
event
;
}
}
private
onTouchStart
(
e
:
TouchEvent
):
void
{
private
onTouchStart
(
e
:
TouchEvent
):
void
{
var
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
let
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
e
.
preventDefault
();
e
.
preventDefault
();
e
.
stopPropagation
();
e
.
stopPropagation
();
...
@@ -120,8 +120,8 @@ export class Gesture implements Lifecycle.IDisposable {
...
@@ -120,8 +120,8 @@ export class Gesture implements Lifecycle.IDisposable {
this
.
handle
=
null
;
this
.
handle
=
null
;
}
}
for
(
var
i
=
0
,
len
=
e
.
targetTouches
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
e
.
targetTouches
.
length
;
i
<
len
;
i
++
)
{
var
touch
=
e
.
targetTouches
.
item
(
i
);
let
touch
=
e
.
targetTouches
.
item
(
i
);
this
.
activeTouches
[
touch
.
identifier
]
=
{
this
.
activeTouches
[
touch
.
identifier
]
=
{
id
:
touch
.
identifier
,
id
:
touch
.
identifier
,
...
@@ -134,49 +134,49 @@ export class Gesture implements Lifecycle.IDisposable {
...
@@ -134,49 +134,49 @@ export class Gesture implements Lifecycle.IDisposable {
rollingPageY
:
[
touch
.
pageY
]
rollingPageY
:
[
touch
.
pageY
]
};
};
var
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Start
);
let
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Start
);
evt
.
pageX
=
touch
.
pageX
;
evt
.
pageX
=
touch
.
pageX
;
evt
.
pageY
=
touch
.
pageY
;
evt
.
pageY
=
touch
.
pageY
;
this
.
targetElement
.
dispatchEvent
(
evt
);
this
.
targetElement
.
dispatchEvent
(
evt
);
}
}
}
}
private
onTouchEnd
(
e
:
TouchEvent
):
void
{
private
onTouchEnd
(
e
:
TouchEvent
):
void
{
var
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
let
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
e
.
preventDefault
();
e
.
preventDefault
();
e
.
stopPropagation
();
e
.
stopPropagation
();
var
activeTouchCount
=
Object
.
keys
(
this
.
activeTouches
).
length
;
let
activeTouchCount
=
Object
.
keys
(
this
.
activeTouches
).
length
;
for
(
var
i
=
0
,
len
=
e
.
changedTouches
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
e
.
changedTouches
.
length
;
i
<
len
;
i
++
)
{
var
touch
=
e
.
changedTouches
.
item
(
i
);
let
touch
=
e
.
changedTouches
.
item
(
i
);
if
(
!
this
.
activeTouches
.
hasOwnProperty
(
String
(
touch
.
identifier
)))
{
if
(
!
this
.
activeTouches
.
hasOwnProperty
(
String
(
touch
.
identifier
)))
{
console
.
warn
(
'
move of an UNKNOWN touch
'
,
touch
);
console
.
warn
(
'
move of an UNKNOWN touch
'
,
touch
);
continue
;
continue
;
}
}
var
data
=
this
.
activeTouches
[
touch
.
identifier
],
let
data
=
this
.
activeTouches
[
touch
.
identifier
],
holdTime
=
Date
.
now
()
-
data
.
initialTimeStamp
;
holdTime
=
Date
.
now
()
-
data
.
initialTimeStamp
;
if
(
holdTime
<
Gesture
.
HOLD_DELAY
&&
if
(
holdTime
<
Gesture
.
HOLD_DELAY
&&
Math
.
abs
(
data
.
initialPageX
-
A
rrays
.
tail
(
data
.
rollingPageX
))
<
30
&&
Math
.
abs
(
data
.
initialPageX
-
a
rrays
.
tail
(
data
.
rollingPageX
))
<
30
&&
Math
.
abs
(
data
.
initialPageY
-
A
rrays
.
tail
(
data
.
rollingPageY
))
<
30
)
{
Math
.
abs
(
data
.
initialPageY
-
a
rrays
.
tail
(
data
.
rollingPageY
))
<
30
)
{
var
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Tap
);
let
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Tap
);
evt
.
initialTarget
=
data
.
initialTarget
;
evt
.
initialTarget
=
data
.
initialTarget
;
evt
.
pageX
=
A
rrays
.
tail
(
data
.
rollingPageX
);
evt
.
pageX
=
a
rrays
.
tail
(
data
.
rollingPageX
);
evt
.
pageY
=
A
rrays
.
tail
(
data
.
rollingPageY
);
evt
.
pageY
=
a
rrays
.
tail
(
data
.
rollingPageY
);
this
.
targetElement
.
dispatchEvent
(
evt
);
this
.
targetElement
.
dispatchEvent
(
evt
);
}
else
if
(
activeTouchCount
===
1
)
{
}
else
if
(
activeTouchCount
===
1
)
{
var
finalX
=
A
rrays
.
tail
(
data
.
rollingPageX
);
let
finalX
=
a
rrays
.
tail
(
data
.
rollingPageX
);
var
finalY
=
A
rrays
.
tail
(
data
.
rollingPageY
);
let
finalY
=
a
rrays
.
tail
(
data
.
rollingPageY
);
var
deltaT
=
A
rrays
.
tail
(
data
.
rollingTimestamps
)
-
data
.
rollingTimestamps
[
0
];
let
deltaT
=
a
rrays
.
tail
(
data
.
rollingTimestamps
)
-
data
.
rollingTimestamps
[
0
];
var
deltaX
=
finalX
-
data
.
rollingPageX
[
0
];
let
deltaX
=
finalX
-
data
.
rollingPageX
[
0
];
var
deltaY
=
finalY
-
data
.
rollingPageY
[
0
];
let
deltaY
=
finalY
-
data
.
rollingPageY
[
0
];
this
.
inertia
(
timestamp
,
// time now
this
.
inertia
(
timestamp
,
// time now
Math
.
abs
(
deltaX
)
/
deltaT
,
// speed
Math
.
abs
(
deltaX
)
/
deltaT
,
// speed
...
@@ -193,59 +193,59 @@ export class Gesture implements Lifecycle.IDisposable {
...
@@ -193,59 +193,59 @@ export class Gesture implements Lifecycle.IDisposable {
}
}
}
}
private
inertia
(
t1
:
number
,
vX
:
number
,
dirX
:
number
,
x
:
number
,
vY
:
number
,
dirY
:
number
,
y
:
number
):
void
{
private
inertia
(
t1
:
number
,
vX
:
number
,
dirX
:
number
,
x
:
number
,
vY
:
number
,
dirY
:
number
,
y
:
number
):
void
{
this
.
handle
=
DomUtils
.
scheduleAtNextAnimationFrame
(()
=>
{
this
.
handle
=
DomUtils
.
scheduleAtNextAnimationFrame
(()
=>
{
var
now
=
Date
.
now
();
let
now
=
Date
.
now
();
// velocity: old speed + accel_over_time
// velocity: old speed + accel_over_time
var
deltaT
=
now
-
t1
,
let
deltaT
=
now
-
t1
,
delta_pos_x
=
0
,
delta_pos_y
=
0
,
delta_pos_x
=
0
,
delta_pos_y
=
0
,
stopped
=
true
;
stopped
=
true
;
vX
+=
Gesture
.
SCROLL_FRICTION
*
deltaT
;
vX
+=
Gesture
.
SCROLL_FRICTION
*
deltaT
;
vY
+=
Gesture
.
SCROLL_FRICTION
*
deltaT
;
vY
+=
Gesture
.
SCROLL_FRICTION
*
deltaT
;
if
(
vX
>
0
)
{
if
(
vX
>
0
)
{
stopped
=
false
;
stopped
=
false
;
delta_pos_x
=
dirX
*
vX
*
deltaT
;
delta_pos_x
=
dirX
*
vX
*
deltaT
;
}
}
if
(
vY
>
0
)
{
if
(
vY
>
0
)
{
stopped
=
false
;
stopped
=
false
;
delta_pos_y
=
dirY
*
vY
*
deltaT
;
delta_pos_y
=
dirY
*
vY
*
deltaT
;
}
}
// dispatch translation event
// dispatch translation event
var
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Change
);
let
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Change
);
evt
.
translationX
=
delta_pos_x
;
evt
.
translationX
=
delta_pos_x
;
evt
.
translationY
=
delta_pos_y
;
evt
.
translationY
=
delta_pos_y
;
this
.
targetElement
.
dispatchEvent
(
evt
);
this
.
targetElement
.
dispatchEvent
(
evt
);
if
(
!
stopped
)
{
if
(
!
stopped
)
{
this
.
inertia
(
now
,
vX
,
dirX
,
x
+
delta_pos_x
,
vY
,
dirY
,
y
+
delta_pos_y
);
this
.
inertia
(
now
,
vX
,
dirX
,
x
+
delta_pos_x
,
vY
,
dirY
,
y
+
delta_pos_y
);
}
}
});
});
}
}
private
onTouchMove
(
e
:
TouchEvent
):
void
{
private
onTouchMove
(
e
:
TouchEvent
):
void
{
var
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
let
timestamp
=
Date
.
now
();
// use Date.now() because on FF e.timeStamp is not epoch based.
e
.
preventDefault
();
e
.
preventDefault
();
e
.
stopPropagation
();
e
.
stopPropagation
();
for
(
var
i
=
0
,
len
=
e
.
changedTouches
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
e
.
changedTouches
.
length
;
i
<
len
;
i
++
)
{
var
touch
=
e
.
changedTouches
.
item
(
i
);
let
touch
=
e
.
changedTouches
.
item
(
i
);
if
(
!
this
.
activeTouches
.
hasOwnProperty
(
String
(
touch
.
identifier
)))
{
if
(
!
this
.
activeTouches
.
hasOwnProperty
(
String
(
touch
.
identifier
)))
{
console
.
warn
(
'
end of an UNKNOWN touch
'
,
touch
);
console
.
warn
(
'
end of an UNKNOWN touch
'
,
touch
);
continue
;
continue
;
}
}
var
data
=
this
.
activeTouches
[
touch
.
identifier
];
let
data
=
this
.
activeTouches
[
touch
.
identifier
];
var
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Change
);
let
evt
=
Gesture
.
newGestureEvent
(
EventType
.
Change
);
evt
.
translationX
=
touch
.
pageX
-
A
rrays
.
tail
(
data
.
rollingPageX
);
evt
.
translationX
=
touch
.
pageX
-
a
rrays
.
tail
(
data
.
rollingPageX
);
evt
.
translationY
=
touch
.
pageY
-
A
rrays
.
tail
(
data
.
rollingPageY
);
evt
.
translationY
=
touch
.
pageY
-
a
rrays
.
tail
(
data
.
rollingPageY
);
evt
.
pageX
=
touch
.
pageX
;
evt
.
pageX
=
touch
.
pageX
;
evt
.
pageY
=
touch
.
pageY
;
evt
.
pageY
=
touch
.
pageY
;
this
.
targetElement
.
dispatchEvent
(
evt
);
this
.
targetElement
.
dispatchEvent
(
evt
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录