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
5cf688d9
Commit
5cf688d9
authored
Nov 22, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new mobile version (big changes)
parent
b590da6a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
89 deletions
+189
-89
common/Drawings/WorkEvents.js
common/Drawings/WorkEvents.js
+179
-88
word/Drawing/DrawingDocument.js
word/Drawing/DrawingDocument.js
+4
-1
word/Drawing/HtmlPage.js
word/Drawing/HtmlPage.js
+3
-0
word/api.js
word/api.js
+3
-0
No files found.
common/Drawings/WorkEvents.js
View file @
5cf688d9
...
...
@@ -841,6 +841,7 @@
this
.
HtmlPage
=
null
;
this
.
Mode
=
0
;
this
.
IsTouching
=
false
;
this
.
ReadingGlassTime
=
750
;
this
.
TimeDown
=
0
;
...
...
@@ -884,7 +885,9 @@
this
.
TableCurrentMoveValueMin
=
null
;
this
.
TableCurrentMoveValueMax
=
null
;
this
.
ShowMenuTimerId
=
-
1
;
this
.
ContextMenuLastMode
=
0
;
// 0 - none, 1 - target, 2 - select (text), 3 - object(s)
this
.
ContextMenuLastModeCounter
=
0
;
this
.
ContextMenuShowTimerId
=
-
1
;
this
.
Init
=
function
(
ctrl
)
{
...
...
@@ -900,7 +903,7 @@
});
LoadMobileImages
();
}
}
;
this
.
MoveCursorToPoint
=
function
(
e
)
{
...
...
@@ -918,10 +921,23 @@
this
.
DrawingDocument
.
NeedScrollToTargetFlag
=
false
;
global_mouseEvent
.
ClickCount
=
old_click_count
;
}
};
this
.
IsWorkedPosition
=
function
()
{
if
(
this
.
IsTouching
)
return
true
;
if
(
this
.
iScroll
&&
this
.
iScroll
.
animating
)
return
true
;
return
false
;
};
this
.
onTouchStart
=
function
(
e
)
{
this
.
IsTouching
=
true
;
if
(
null
!=
this
.
DrawingDocument
.
m_oDocumentRenderer
)
return
this
.
onTouchStart_renderer
(
e
);
...
...
@@ -1387,7 +1403,7 @@
e
.
returnValue
=
false
;
return
false
;
}
}
}
;
this
.
onTouchMove
=
function
(
e
)
{
if
(
null
!=
this
.
DrawingDocument
.
m_oDocumentRenderer
)
...
...
@@ -1585,21 +1601,24 @@
default
:
break
;
}
}
}
;
this
.
onTouchEnd
=
function
(
e
)
{
this
.
IsTouching
=
false
;
if
(
null
!=
this
.
DrawingDocument
.
m_oDocumentRenderer
)
return
this
.
onTouchEnd_renderer
(
e
);
if
(
this
.
Mode
!=
MobileTouchMode
.
FlowObj
&&
this
.
Mode
!=
MobileTouchMode
.
TableMove
)
{
check_MouseUpEvent
(
e
.
changedTouches
?
e
.
changedTouches
[
0
]
:
e
);
}
this
.
ScrollH
=
this
.
HtmlPage
.
m_dScrollX
;
this
.
ScrollV
=
this
.
HtmlPage
.
m_dScrollY
;
var
isCheckContextMenuMode
=
true
;
switch
(
this
.
Mode
)
{
case
MobileTouchMode
.
Cursor
:
...
...
@@ -1636,6 +1655,7 @@
{
// нужно запускать анимацию скролла, если она есть
// TODO:
isCheckContextMenuMode
=
false
;
this
.
iScroll
.
_end
(
e
);
}
...
...
@@ -1650,6 +1670,7 @@
this
.
HtmlPage
.
OnScroll
();
this
.
Mode
=
MobileTouchMode
.
None
;
isCheckContextMenuMode
=
false
;
break
;
}
case
MobileTouchMode
.
InlineObj
:
...
...
@@ -1786,9 +1807,9 @@
return
false
;
}
// если есть селект - то показать меню
this
.
CheckSelectEnd
(
tru
e
);
}
if
(
!
this
.
iScroll
.
animating
)
this
.
CheckContextMenuTouchEnd
(
isCheckContextMenuMod
e
);
}
;
this
.
onTouchStart_renderer
=
function
(
e
)
{
...
...
@@ -1851,7 +1872,7 @@
e
.
preventDefault
();
else
e
.
returnValue
=
false
;
}
}
;
this
.
onTouchMove_renderer
=
function
(
e
)
{
check_MouseMoveEvent
(
e
.
touches
?
e
.
touches
[
0
]
:
e
);
...
...
@@ -1915,7 +1936,7 @@
e
.
preventDefault
();
else
e
.
returnValue
=
false
;
}
}
;
this
.
onTouchEnd_renderer
=
function
(
e
)
{
check_MouseUpEvent
(
e
.
changedTouches
?
e
.
changedTouches
[
0
]
:
e
);
...
...
@@ -1957,50 +1978,7 @@
e
.
preventDefault
();
else
e
.
returnValue
=
false
;
}
this
.
CheckSelectEnd
=
function
(
bIsAttack
)
{
this
.
CheckSelectRects
();
var
_bIsRet
=
false
;
if
(
!
bIsAttack
)
_bIsRet
=
this
.
IsTrackingCurrent
;
if
(
_bIsRet
)
return
;
if
(
null
!=
this
.
RectSelect1
&&
null
!=
this
.
RectSelect2
&&
!
this
.
HtmlPage
.
m_oApi
.
isViewMode
)
{
var
_matrix
=
this
.
DrawingDocument
.
SelectionMatrix
;
var
pos1
=
null
;
var
pos4
=
null
;
if
(
!
_matrix
||
global_MatrixTransformer
.
IsIdentity
(
_matrix
))
{
pos1
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
,
this
.
PageSelect1
);
pos4
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
,
this
.
PageSelect2
);
}
else
{
var
_x1
=
_matrix
.
TransformPointX
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
);
var
_y1
=
_matrix
.
TransformPointY
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
);
var
_x2
=
_matrix
.
TransformPointX
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
);
var
_y2
=
_matrix
.
TransformPointY
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
);
pos1
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_x1
,
_y1
,
this
.
PageSelect1
);
pos4
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_x2
,
_y2
,
this
.
PageSelect2
);
}
var
_x
=
(
pos1
.
X
+
pos4
.
X
)
>>
1
;
var
_y
=
pos1
.
Y
;
if
(
!
this
.
iScroll
.
animating
)
this
.
SendShowMenu
(
_x
,
_y
);
}
}
};
this
.
CheckZoomCriticalValues
=
function
(
zoomMin
)
{
...
...
@@ -2038,61 +2016,174 @@
this
.
ZoomValue
=
this
.
ZoomValueMin
;
this
.
HtmlPage
.
m_oApi
.
zoom
(
this
.
ZoomValue
);
}
}
}
;
this
.
Resize
=
function
()
{
if
(
this
.
iScroll
!=
null
)
this
.
iScroll
.
refresh
(
true
);
}
}
;
this
.
SendShow
Menu
=
function
(
x
,
y
)
this
.
SendShow
ContextMenu
=
function
(
)
{
if
(
-
1
!=
this
.
ShowMenu
TimerId
)
if
(
-
1
!=
this
.
ContextMenuShow
TimerId
)
{
clearTimeout
(
this
.
ShowMenu
TimerId
);
clearTimeout
(
this
.
ContextMenuShow
TimerId
);
}
var
that
=
this
;
th
at
.
ShowMenu
TimerId
=
setTimeout
(
function
()
th
is
.
ContextMenuShow
TimerId
=
setTimeout
(
function
()
{
that
.
HtmlPage
.
m_oApi
.
sendEvent
(
"
asc_onShowPopMenu
"
,
x
,
y
);
var
_pos
=
that
.
GetContextMenuPosition
();
that
.
HtmlPage
.
m_oApi
.
sendEvent
(
"
asc_onShowPopMenu
"
,
_pos
.
X
,
_pos
.
Y
,
(
_pos
.
Mode
>
1
)
?
true
:
false
);
},
500
);
}
}
;
this
.
OnScrollAnimationEnd
=
function
()
this
.
GetContextMenuPosition
=
function
()
{
if
(
this
.
HtmlPage
.
m_oApi
.
isViewMode
)
return
;
var
_posX
=
0
;
var
_posY
=
0
;
var
_page
=
0
;
var
_transform
=
null
;
var
tmpX
,
tmpY
,
tmpX2
,
tmpY2
;
var
_pos
=
null
;
if
(
null
!=
this
.
RectSelect1
&&
null
!=
this
.
RectSelect2
)
var
_mode
=
0
;
var
_target
=
this
.
LogicDocument
.
Is_SelectionUse
();
if
(
_target
===
false
)
{
var
pos1
=
null
;
var
pos4
=
null
;
_posX
=
this
.
DrawingDocument
.
m_dTargetX
;
_posY
=
this
.
DrawingDocument
.
m_dTargetY
;
_page
=
this
.
DrawingDocument
.
m_lTargetPage
;
_transform
=
this
.
DrawingDocument
.
TextMatrix
;
var
_matrix
=
this
.
DrawingDocument
.
SelectionMatrix
;
if
(
!
_matrix
||
global_MatrixTransformer
.
IsIdentity
(
_matrix
))
if
(
_transform
)
{
pos1
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
,
this
.
PageSelect1
);
pos4
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
,
this
.
PageSelect2
);
tmpX
=
_transform
.
TransformPointX
(
_posX
,
_posY
);
tmpY
=
_transform
.
TransformPointY
(
_posX
,
_posY
);
}
else
{
var
_x1
=
_matrix
.
TransformPointX
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
);
var
_y1
=
_matrix
.
TransformPointY
(
this
.
RectSelect1
.
x
,
this
.
RectSelect1
.
y
);
tmpX
=
_posX
;
tmpY
=
_posY
;
}
_pos
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
tmpX
,
tmpY
,
_page
);
_posX
=
_pos
.
X
;
_posY
=
_pos
.
Y
;
_mode
=
1
;
}
var
_select
=
this
.
LogicDocument
.
Get_SelectionBounds
();
if
(
_select
)
{
var
_rect1
=
_select
.
Start
;
var
_rect2
=
_select
.
End
;
tmpX
=
_rect1
.
X
;
tmpY
=
_rect1
.
Y
;
tmpX2
=
_rect2
.
X
+
_rect2
.
W
;
tmpY2
=
_rect2
.
Y
+
_rect2
.
H
;
_transform
=
this
.
DrawingDocument
.
SelectionMatrix
;
if
(
_transform
)
{
_posX
=
_transform
.
TransformPointX
(
tmpX
,
tmpY
);
_posY
=
_transform
.
TransformPointY
(
tmpX
,
tmpY
);
tmpX
=
_posX
;
tmpY
=
_posY
;
var
_x2
=
_matrix
.
TransformPointX
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
);
var
_y2
=
_matrix
.
TransformPointY
(
this
.
RectSelect2
.
x
+
this
.
RectSelect2
.
w
,
this
.
RectSelect2
.
y
+
this
.
RectSelect2
.
h
);
_posX
=
_transform
.
TransformPointX
(
tmpX2
,
tmpY2
);
_posY
=
_transform
.
TransformPointY
(
tmpX2
,
tmpY2
);
pos1
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_x1
,
_y1
,
this
.
PageSelect1
)
;
pos4
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_x2
,
_y2
,
this
.
PageSelect2
)
;
tmpX2
=
_posX
;
tmpY2
=
_posY
;
}
var
_x
=
(
pos1
.
X
+
pos4
.
X
)
>>
1
;
var
_y
=
pos1
.
Y
;
_pos
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
tmpX
,
tmpY
,
_rect1
.
Page
);
_posX
=
_pos
.
X
;
_posY
=
_pos
.
Y
;
this
.
SendShowMenu
(
_x
,
_y
);
_pos
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
tmpX2
,
tmpY2
,
_rect2
.
Page
);
_posX
+=
_pos
.
X
;
_posX
=
_posX
>>
1
;
_mode
=
2
;
}
var
_object_bounds
=
this
.
LogicDocument
.
DrawingObjects
.
getSelectedObjectsBounds
();
if
((
0
==
_mode
)
&&
_object_bounds
)
{
_pos
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_object_bounds
.
minX
,
_object_bounds
.
minY
,
_object_bounds
.
pageIndex
);
_posX
=
_pos
.
X
;
_posY
=
_pos
.
Y
;
_pos
=
this
.
DrawingDocument
.
ConvertCoordsToCursorWR
(
_object_bounds
.
maxX
,
_object_bounds
.
maxY
,
_object_bounds
.
pageIndex
);
_posX
+=
_pos
.
X
;
_posX
=
_posX
>>
1
;
_mode
=
3
;
}
return
{
X
:
_posX
,
Y
:
_posY
,
Mode
:
_mode
};
};
this
.
GetContextMenuType
=
function
()
{
var
_mode
=
0
;
if
(
!
this
.
LogicDocument
.
Is_SelectionUse
())
_mode
=
1
;
// target
if
(
this
.
LogicDocument
.
Get_SelectionBounds
())
_mode
=
2
;
// select
if
(
_mode
==
0
&&
this
.
LogicDocument
.
DrawingObjects
.
getSelectedObjectsBounds
())
_mode
=
3
;
// object
return
_mode
;
};
this
.
CheckContextMenuTouchEnd
=
function
(
isCheck
)
{
// isCheck: если пришли сюда после скролла или зума (или их анимации) - то не нужно проверять состояние редактора.
// Нужно проверять последнее сохраненной состояние
if
(
isCheck
)
{
var
_mode
=
this
.
GetContextMenuType
();
if
(
_mode
==
this
.
ContextMenuLastMode
)
{
this
.
ContextMenuLastModeCounter
++
;
this
.
ContextMenuLastModeCounter
&=
0x01
;
}
else
this
.
ContextMenuLastModeCounter
=
0
;
this
.
ContextMenuLastMode
=
_mode
;
}
}
if
(
this
.
ContextMenuLastMode
>
0
&&
1
==
this
.
ContextMenuLastModeCounter
)
this
.
SendShowContextMenu
();
};
this
.
ClearContextMenu
=
function
()
{
this
.
ContextMenuLastMode
=
0
;
this
.
ContextMenuLastModeCounter
=
0
;
this
.
HtmlPage
.
m_oApi
.
sendEvent
(
"
asc_onHidePopMenu
"
);
};
this
.
OnScrollAnimationEnd
=
function
()
{
if
(
this
.
HtmlPage
.
m_oApi
.
isViewMode
)
return
;
this
.
CheckContextMenuTouchEnd
(
false
);
};
this
.
CheckSelectRects
=
function
()
{
...
...
@@ -2125,7 +2216,7 @@
this
.
RectSelect2
.
w
=
_rect2
.
W
;
this
.
RectSelect2
.
h
=
_rect2
.
H
;
this
.
PageSelect2
=
_rect2
.
Page
;
}
}
;
this
.
CheckSelect
=
function
(
overlay
)
{
...
...
@@ -2237,7 +2328,7 @@
overlay
.
AddEllipse
(
pos4
.
X
,
pos4
.
Y
+
5
,
5
);
ctx
.
fill
();
}
}
}
;
this
.
CheckSelect2
=
function
(
overlay
)
{
...
...
@@ -2352,7 +2443,7 @@
overlay
.
CheckRect
(
_x1
,
_y1
,
_w
,
_h
);
overlay
.
CheckRect
(
_x2
,
_y2
,
_w
,
_h
);
}
}
}
;
this
.
CheckTableRules
=
function
(
overlay
)
{
...
...
@@ -2599,7 +2690,7 @@
}
}
}
}
}
;
this
.
CheckTableRules2
=
function
(
overlay
)
{
...
...
@@ -2892,7 +2983,7 @@
}
}
}
}
}
;
}
function
CReaderTouchManager
()
...
...
word/Drawing/DrawingDocument.js
View file @
5cf688d9
...
...
@@ -2179,6 +2179,9 @@ function CDrawingDocument()
{
this
.
m_lCountCalculatePages
=
pageCount
;
//console.log("start " + this.m_lCountCalculatePages);
if
(
this
.
m_oWordControl
&&
this
.
m_oWordControl
.
MobileTouchManager
)
this
.
m_oWordControl
.
MobileTouchManager
.
ClearContextMenu
();
}
this
.
OnRepaintPage
=
function
(
index
)
...
...
@@ -6067,7 +6070,7 @@ function CDrawingDocument()
this
.
OnSelectEnd
=
function
()
{
if
(
this
.
m_oWordControl
&&
this
.
m_oWordControl
.
MobileTouchManager
)
this
.
m_oWordControl
.
MobileTouchManager
.
CheckSelect
End
(
false
);
this
.
m_oWordControl
.
MobileTouchManager
.
CheckSelect
Rects
(
);
}
// mouse events
...
...
word/Drawing/HtmlPage.js
View file @
5cf688d9
...
...
@@ -3121,6 +3121,9 @@ function CEditorPage(api)
this
.
OnCalculatePagesPlace
=
function
()
{
if
(
this
.
MobileTouchManager
&&
!
this
.
MobileTouchManager
.
IsWorkedPosition
())
this
.
MobileTouchManager
.
ClearContextMenu
();
var
canvas
=
this
.
m_oEditor
.
HtmlElement
;
if
(
null
==
canvas
)
return
;
...
...
word/api.js
View file @
5cf688d9
...
...
@@ -1739,6 +1739,9 @@ background-repeat: no-repeat;\
this
.
sync_TextPosition
(
TextPr
.
Position
);
this
.
sync_TextLangCallBack
(
TextPr
.
Lang
);
this
.
sync_TextColor
(
TextPr
);
if
(
this
.
isMobileVersion
)
this
.
sendEvent
(
"
asc_onTextShd
"
,
new
Asc
.
asc_CParagraphShd
(
TextPr
.
Shd
));
}
};
asc_docs_api
.
prototype
.
UpdateParagraphProp
=
function
(
ParaPr
)
...
...
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