Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
fd5b30c2
Commit
fd5b30c2
authored
Aug 18, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1) touch bugs
2) scroll with browser
parent
35680836
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
159 additions
and
18 deletions
+159
-18
common/Drawings/WorkEvents.js
common/Drawings/WorkEvents.js
+71
-3
common/scroll.js
common/scroll.js
+7
-3
slide/Drawing/DrawingDocument.js
slide/Drawing/DrawingDocument.js
+0
-1
slide/Drawing/HtmlPage.js
slide/Drawing/HtmlPage.js
+1
-1
word/Drawing/HtmlPage.js
word/Drawing/HtmlPage.js
+80
-10
No files found.
common/Drawings/WorkEvents.js
View file @
fd5b30c2
...
...
@@ -34,7 +34,9 @@
(
function
(
window
,
undefined
)
{
AscCommon
.
isTouch
=
false
;
AscCommon
.
isTouchMove
=
false
;
AscCommon
.
TouchStartTime
=
-
1
;
// Import
var
AscBrowser
=
AscCommon
.
AscBrowser
;
var
global_MatrixTransformer
=
AscCommon
.
global_MatrixTransformer
;
...
...
@@ -301,7 +303,7 @@
global_keyboardEvent
.
CtrlKey
=
global_mouseEvent
.
CtrlKey
;
global_mouseEvent
.
Type
=
g_mouse_event_type_up
;
global_mouseEvent
.
Button
=
e
.
button
;
global_mouseEvent
.
Button
=
(
e
.
button
!==
undefined
)
?
e
.
button
:
0
;
var
lockedElement
=
null
;
...
...
@@ -362,7 +364,7 @@
global_keyboardEvent
.
CtrlKey
=
global_mouseEvent
.
CtrlKey
;
global_mouseEvent
.
Type
=
g_mouse_event_type_down
;
global_mouseEvent
.
Button
=
e
.
button
;
global_mouseEvent
.
Button
=
(
e
.
button
!==
undefined
)
?
e
.
button
:
0
;
global_mouseEvent
.
Sender
=
(
e
.
srcElement
)
?
e
.
srcElement
:
e
.
target
;
...
...
@@ -620,6 +622,70 @@
}
}
function
emulateKeyDown
(
_code
,
_element
)
{
var
oEvent
=
document
.
createEvent
(
'
KeyboardEvent
'
);
// Chromium Hack
Object
.
defineProperty
(
oEvent
,
'
keyCode
'
,
{
get
:
function
()
{
return
this
.
keyCodeVal
;
}
});
Object
.
defineProperty
(
oEvent
,
'
which
'
,
{
get
:
function
()
{
return
this
.
keyCodeVal
;
}
});
Object
.
defineProperty
(
oEvent
,
'
shiftKey
'
,
{
get
:
function
()
{
return
false
;
}
});
Object
.
defineProperty
(
oEvent
,
'
altKey
'
,
{
get
:
function
()
{
return
false
;
}
});
Object
.
defineProperty
(
oEvent
,
'
metaKey
'
,
{
get
:
function
()
{
return
false
;
}
});
Object
.
defineProperty
(
oEvent
,
'
ctrlKey
'
,
{
get
:
function
()
{
return
false
;
}
});
if
(
AscCommon
.
AscBrowser
.
isIE
)
{
oEvent
.
preventDefault
=
function
()
{
Object
.
defineProperty
(
this
,
"
defaultPrevented
"
,
{
get
:
function
()
{
return
true
;}});
};
}
if
(
oEvent
.
initKeyboardEvent
)
{
oEvent
.
initKeyboardEvent
(
"
keydown
"
,
true
,
true
,
window
,
false
,
false
,
false
,
false
,
_code
,
_code
);
}
else
{
oEvent
.
initKeyEvent
(
"
keydown
"
,
true
,
true
,
window
,
false
,
false
,
false
,
false
,
_code
,
0
);
}
oEvent
.
keyCodeVal
=
_code
;
_element
.
dispatchEvent
(
oEvent
);
return
oEvent
.
defaultPrevented
;
}
function
CTouchManager
()
{
this
.
touches
=
[];
...
...
@@ -2881,4 +2947,6 @@
window
[
'
AscCommon
'
].
button_eventHandlers
=
button_eventHandlers
;
window
[
'
AscCommon
'
].
CMobileTouchManager
=
CMobileTouchManager
;
window
[
'
AscCommon
'
].
CReaderTouchManager
=
CReaderTouchManager
;
window
[
'
AscCommon
'
].
emulateKeyDown
=
emulateKeyDown
;
})(
window
);
common/scroll.js
View file @
fd5b30c2
...
...
@@ -37,6 +37,10 @@
* @param {undefined} undefined
*/
function
(
window
,
undefined
)
{
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
var
AscCommon
=
window
[
'
AscCommon
'
];
var
debug
=
false
;
var
ScrollArrowType
=
{
...
...
@@ -1784,8 +1788,9 @@ ScrollObject.prototype = {
}
// return relative mouse position
var
mouseX
=
evt
.
clientX
-
left
+
window
.
pageXOffset
;
var
mouseY
=
evt
.
clientY
-
top
+
window
.
pageYOffset
;
var
mouseX
=
((
evt
.
clientX
*
AscCommon
.
AscBrowser
.
zoom
)
>>
0
)
-
left
+
window
.
pageXOffset
;
var
mouseY
=
((
evt
.
clientY
*
AscCommon
.
AscBrowser
.
zoom
)
>>
0
)
-
top
+
window
.
pageYOffset
;
return
{
x
:
mouseX
,
y
:
mouseY
...
...
@@ -3352,6 +3357,5 @@ ScrollObject.prototype = {
};
//---------------------------------------------------------export---------------------------------------------------
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
window
[
"
AscCommon
"
].
ScrollObject
=
ScrollObject
;
})(
window
);
slide/Drawing/DrawingDocument.js
View file @
fd5b30c2
...
...
@@ -1773,7 +1773,6 @@ function CDrawingDocument()
if
(
false
===
this
.
m_bIsSelection
)
{
this
.
SelectClear
();
this
.
m_oWordControl
.
CheckUnShowOverlay
();
this
.
m_oWordControl
.
OnUpdateOverlay
();
this
.
m_oWordControl
.
m_oOverlayApi
.
m_oContext
.
globalAlpha
=
1.0
;
}
...
...
slide/Drawing/HtmlPage.js
View file @
fd5b30c2
...
...
@@ -537,10 +537,10 @@ function CEditorPage(api)
this
.
m_oDrawingDocument
.
TargetHtmlElement
=
document
.
getElementById
(
'
id_target_cursor
'
);
this
.
UnShowOverlay
();
this
.
m_oOverlayApi
.
m_oControl
=
this
.
m_oOverlay
;
this
.
m_oOverlayApi
.
m_oHtmlPage
=
this
;
this
.
m_oOverlayApi
.
Clear
();
this
.
ShowOverlay
();
this
.
m_oDrawingDocument
.
AutoShapesTrack
=
new
AscCommon
.
CAutoshapeTrack
();
this
.
m_oDrawingDocument
.
AutoShapesTrack
.
init2
(
this
.
m_oOverlayApi
);
...
...
word/Drawing/HtmlPage.js
View file @
fd5b30c2
...
...
@@ -485,10 +485,10 @@ function CEditorPage(api)
this
.
checkNeedRules
();
this
.
initEvents2
();
this
.
UnShowOverlay
();
this
.
m_oOverlayApi
.
m_oControl
=
this
.
m_oOverlay
;
this
.
m_oOverlayApi
.
m_oHtmlPage
=
this
;
this
.
m_oOverlayApi
.
Clear
();
this
.
ShowOverlay
();
this
.
m_oDrawingDocument
.
AutoShapesTrack
=
new
AscCommon
.
CAutoshapeTrack
();
this
.
m_oDrawingDocument
.
AutoShapesTrack
.
init2
(
this
.
m_oOverlayApi
);
...
...
@@ -693,31 +693,44 @@ function CEditorPage(api)
return
e
;
};
this
.
m_oEditor
.
HtmlElement
[
"
ontouchstart
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchstart
"
]
=
function
(
e
)
{
var
_cur
=
document
.
getElementById
(
'
id_target_cursor
'
);
_cur
[
"
ontouchstart
"
]
=
this
.
m_oEditor
.
HtmlElement
[
"
ontouchstart
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchstart
"
]
=
function
(
e
)
{
//console.log("start: " + AscCommon.isTouch);
if
(
AscCommon
.
isTouch
)
return
;
var
_old
=
global_mouseEvent
.
KoefPixToMM
;
global_mouseEvent
.
KoefPixToMM
=
5
;
AscCommon
.
isTouch
=
true
;
AscCommon
.
isTouch
=
true
;
AscCommon
.
isTouchMove
=
false
;
AscCommon
.
TouchStartTime
=
new
Date
().
getTime
();
AscCommon
.
stopEvent
(
e
);
var
_ret
=
this
.
onmousedown
(
_check_e
(
e
),
true
);
global_mouseEvent
.
KoefPixToMM
=
_old
;
if
((
document
.
activeElement
!==
undefined
)
&&
(
AscCommon
.
g_inputContext
!=
null
)
&&
(
document
.
activeElement
!=
AscCommon
.
g_inputContext
.
HtmlArea
))
{
AscCommon
.
g_inputContext
.
HtmlArea
.
focus
();
}
return
_ret
;
};
this
.
m_oEditor
.
HtmlElement
[
"
ontouchmove
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchmove
"
]
=
function
(
e
)
{
_cur
[
"
ontouchmove
"
]
=
this
.
m_oEditor
.
HtmlElement
[
"
ontouchmove
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchmove
"
]
=
function
(
e
)
{
//console.log("move: " + AscCommon.isTouch);
var
_old
=
global_mouseEvent
.
KoefPixToMM
;
global_mouseEvent
.
KoefPixToMM
=
5
;
AscCommon
.
isTouch
=
true
;
AscCommon
.
isTouch
=
true
;
AscCommon
.
isTouchMove
=
true
;
AscCommon
.
stopEvent
(
e
);
var
_ret
=
this
.
onmousemove
(
_check_e
(
e
),
true
);
global_mouseEvent
.
KoefPixToMM
=
_old
;
return
_ret
;
};
this
.
m_oEditor
.
HtmlElement
[
"
ontouchend
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchend
"
]
=
function
(
e
)
{
_cur
[
"
ontouchend
"
]
=
this
.
m_oEditor
.
HtmlElement
[
"
ontouchend
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchend
"
]
=
function
(
e
)
{
//console.log("end: " + AscCommon.isTouch);
if
(
!
AscCommon
.
isTouch
)
...
...
@@ -727,11 +740,40 @@ function CEditorPage(api)
global_mouseEvent
.
KoefPixToMM
=
5
;
AscCommon
.
isTouch
=
false
;
AscCommon
.
stopEvent
(
e
);
var
_ret
=
this
.
onmouseup
(
_check_e
(
e
),
undefined
,
true
);
var
_natE
=
_check_e
(
e
);
var
_ret
=
this
.
onmouseup
(
_natE
,
undefined
,
true
);
global_mouseEvent
.
KoefPixToMM
=
_old
;
if
(
!
AscCommon
.
isTouchMove
&&
(
-
1
!=
AscCommon
.
TouchStartTime
)
&&
(
Math
.
abs
(
AscCommon
.
TouchStartTime
-
(
new
Date
().
getTime
()))
>
900
))
{
var
_eContextMenu
=
{
pageX
:
_natE
.
pageX
,
pageY
:
_natE
.
pageY
,
clientX
:
_natE
.
clientX
,
clientY
:
_natE
.
clientY
,
altKey
:
_natE
.
altKey
,
shiftKey
:
_natE
.
shiftKey
,
ctrlKey
:
_natE
.
ctrlKey
,
metaKey
:
_natE
.
metaKey
,
button
:
AscCommon
.
g_mouse_button_right
,
target
:
e
.
target
,
srcElement
:
e
.
srcElement
};
AscCommon
.
isTouch
=
true
;
this
.
onmousedown
(
_eContextMenu
,
true
);
this
.
onmouseup
(
_eContextMenu
,
undefined
,
true
);
AscCommon
.
isTouch
=
false
;
}
AscCommon
.
isTouchMove
=
false
;
AscCommon
.
TouchStartTime
=
-
1
;
return
_ret
;
};
this
.
m_oEditor
.
HtmlElement
[
"
ontouchcancel
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchcancel
"
]
=
function
(
e
)
{
_cur
[
"
ontouchcancel
"
]
=
this
.
m_oEditor
.
HtmlElement
[
"
ontouchcancel
"
]
=
this
.
m_oOverlay
.
HtmlElement
[
"
ontouchcancel
"
]
=
function
(
e
)
{
//console.log("cancel: " + AscCommon.isTouch);
if
(
!
AscCommon
.
isTouch
)
...
...
@@ -743,6 +785,34 @@ function CEditorPage(api)
AscCommon
.
stopEvent
(
e
);
var
_ret
=
this
.
onmouseup
(
_check_e
(
e
),
undefined
,
true
);
global_mouseEvent
.
KoefPixToMM
=
_old
;
if
(
!
AscCommon
.
isTouchMove
&&
(
-
1
!=
AscCommon
.
TouchStartTime
)
&&
(
Math
.
abs
(
AscCommon
.
TouchStartTime
-
(
new
Date
().
getTime
()))
>
900
))
{
var
_eContextMenu
=
{
pageX
:
_natE
.
pageX
,
pageY
:
_natE
.
pageY
,
clientX
:
_natE
.
clientX
,
clientY
:
_natE
.
clientY
,
altKey
:
_natE
.
altKey
,
shiftKey
:
_natE
.
shiftKey
,
ctrlKey
:
_natE
.
ctrlKey
,
metaKey
:
_natE
.
metaKey
,
button
:
AscCommon
.
g_mouse_button_right
,
target
:
e
.
target
,
srcElement
:
e
.
srcElement
};
AscCommon
.
isTouch
=
true
;
this
.
onmousedown
(
_eContextMenu
,
true
);
this
.
onmouseup
(
_eContextMenu
,
undefined
,
true
);
AscCommon
.
isTouch
=
false
;
}
AscCommon
.
isTouchMove
=
false
;
AscCommon
.
TouchStartTime
=
-
1
;
return
_ret
;
};
}
...
...
@@ -1633,7 +1703,7 @@ function CEditorPage(api)
this
.
onMouseDown
=
function
(
e
,
isTouch
)
{
//
console.log("down: " + isTouch + ", " + AscCommon.isTouch);
console
.
log
(
"
down:
"
+
isTouch
+
"
,
"
+
AscCommon
.
isTouch
);
if
(
false
===
oThis
.
m_oApi
.
bInit_word_control
||
(
AscCommon
.
isTouch
&&
undefined
===
isTouch
))
return
;
...
...
@@ -1819,7 +1889,7 @@ function CEditorPage(api)
};
this
.
onMouseUp
=
function
(
e
,
bIsWindow
,
isTouch
)
{
//
console.log("up: " + isTouch + ", " + AscCommon.isTouch);
console
.
log
(
"
up:
"
+
isTouch
+
"
,
"
+
AscCommon
.
isTouch
);
if
(
false
===
oThis
.
m_oApi
.
bInit_word_control
||
(
AscCommon
.
isTouch
&&
undefined
===
isTouch
))
return
;
//if (true == global_mouseEvent.IsLocked)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment