]> git.proxmox.com Git - extjs.git/blob - extjs/modern/modern/src/viewport/WindowsPhone.js
add extjs 6.0.1 sources
[extjs.git] / extjs / modern / modern / src / viewport / WindowsPhone.js
1 /**
2 * @private
3 * Windows Phone version of Viewport.
4 */
5 Ext.define('Ext.viewport.WindowsPhone', {
6 requires: [],
7
8 alternateClassName: 'Ext.viewport.WP',
9
10 extend: 'Ext.viewport.Default',
11
12 // so one pixel line is displayed on the right side of the screen. Setting width more than 100% fix the issue
13 // config: {
14 // width: '100.2%',
15 // height: '100.2%'
16 // },
17
18 config: {
19 translatable: {
20 translationMethod: 'csstransform'
21 }
22 },
23
24 initialize: function () {
25 // There is -ms-user-select CSS property for IE10, but it seems it works only in desktop browser. So we need to prevent selection event.
26 var preventSelection = function(e) {
27 var srcElement = e.srcElement.nodeName.toUpperCase(),
28 selectableElements = ['INPUT', 'TEXTAREA'];
29
30 if (selectableElements.indexOf(srcElement) == -1) {
31 return false;
32 }
33 };
34
35 document.body.addEventListener('onselectstart', preventSelection);
36
37 this.addMeta('msapplication-tap-highlight', 'no');
38
39 this.callParent();
40 },
41
42 supportsOrientation: function() {
43 return false;
44 },
45
46 onResize: function() {
47 this.waitUntil(function() {
48 var oldWidth = this.windowWidth,
49 oldHeight = this.windowHeight,
50 width = this.getWindowWidth(),
51 height = this.getWindowHeight(),
52 currentOrientation = this.getOrientation(),
53 newOrientation = this.determineOrientation();
54
55 return ((oldWidth !== width && oldHeight !== height) && currentOrientation !== newOrientation);
56 }, function() {
57 var currentOrientation = this.getOrientation(),
58 newOrientation = this.determineOrientation();
59 this.fireOrientationChangeEvent(newOrientation, currentOrientation);
60
61 }, Ext.emptyFn, 250);
62 }
63 });