Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
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
web-apps
Commits
9492ea3d
Commit
9492ea3d
authored
Nov 22, 2016
by
Alexander Yuzhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DE mobile] Fixed display android context menu.
parent
bc8b38f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
3 deletions
+70
-3
apps/documenteditor/mobile/app/view/DocumentHolder.js
apps/documenteditor/mobile/app/view/DocumentHolder.js
+70
-3
No files found.
apps/documenteditor/mobile/app/view/DocumentHolder.js
View file @
9492ea3d
...
...
@@ -51,6 +51,70 @@ define([
// private
var
_anchorId
=
'
context-menu-target
'
;
function
androidSizeMenu
(
popover
,
target
)
{
popover
.
css
({
left
:
''
,
top
:
''
});
var
modalWidth
=
popover
.
width
();
var
modalHeight
=
popover
.
height
();
var
modalAngleSize
=
10
;
var
targetWidth
=
target
.
outerWidth
();
var
targetHeight
=
target
.
outerHeight
();
var
targetOffset
=
target
.
offset
();
var
targetParentPage
=
target
.
parents
(
'
.page
'
);
if
(
targetParentPage
.
length
>
0
)
{
targetOffset
.
top
=
targetOffset
.
top
-
targetParentPage
[
0
].
scrollTop
;
}
var
windowHeight
=
$
(
window
).
height
();
var
windowWidth
=
$
(
window
).
width
();
var
modalTop
=
0
;
var
modalLeft
=
0
;
// Top Position
var
modalPosition
=
'
top
'
;
// material ? 'bottom' : 'top';
{
if
((
modalHeight
+
modalAngleSize
)
<
targetOffset
.
top
)
{
// On top
modalTop
=
targetOffset
.
top
-
modalHeight
-
modalAngleSize
;
}
else
if
((
modalHeight
+
modalAngleSize
)
<
windowHeight
-
targetOffset
.
top
-
targetHeight
)
{
// On bottom
modalPosition
=
'
bottom
'
;
modalTop
=
targetOffset
.
top
+
targetHeight
+
modalAngleSize
;
}
else
{
// On middle
modalPosition
=
'
middle
'
;
modalTop
=
targetHeight
/
2
+
targetOffset
.
top
-
modalHeight
/
2
;
if
(
modalTop
<=
0
)
{
modalTop
=
5
;
}
else
if
(
modalTop
+
modalHeight
>=
windowHeight
)
{
modalTop
=
windowHeight
-
modalHeight
-
5
;
}
}
// Horizontal Position
if
(
modalPosition
===
'
top
'
||
modalPosition
===
'
bottom
'
)
{
modalLeft
=
targetWidth
/
2
+
targetOffset
.
left
-
modalWidth
/
2
;
if
(
modalLeft
<
5
)
modalLeft
=
5
;
if
(
modalLeft
+
modalWidth
>
windowWidth
)
modalLeft
=
windowWidth
-
modalWidth
-
5
;
}
else
if
(
modalPosition
===
'
middle
'
)
{
modalLeft
=
targetOffset
.
left
-
modalWidth
-
modalAngleSize
;
if
(
modalLeft
<
5
||
(
modalLeft
+
modalWidth
>
windowWidth
))
{
if
(
modalLeft
<
5
)
modalLeft
=
targetOffset
.
left
+
targetWidth
+
modalAngleSize
;
if
(
modalLeft
+
modalWidth
>
windowWidth
)
modalLeft
=
windowWidth
-
modalWidth
-
5
;
}
}
}
// Apply Styles
popover
.
css
({
top
:
modalTop
+
'
px
'
,
left
:
modalLeft
+
'
px
'
});
}
return
{
el
:
'
#editor_sdk
'
,
...
...
@@ -99,7 +163,12 @@ define([
'
</div>
'
+
'
</div>
'
+
'
</div>
'
;
uiApp
.
popover
(
popoverHTML
,
$
(
'
#
'
+
_anchorId
));
var
popover
=
uiApp
.
popover
(
popoverHTML
,
$
(
'
#
'
+
_anchorId
));
if
(
Common
.
SharedSettings
.
get
(
'
android
'
))
{
androidSizeMenu
(
$
(
popover
),
$
(
'
#
'
+
_anchorId
));
}
$
(
'
.modal-overlay
'
).
removeClass
(
'
modal-overlay-visible
'
);
...
...
@@ -109,8 +178,6 @@ define([
this
.
fireEvent
(
'
contextmenu:click
'
,
[
this
,
eventName
]);
},
100
,
this
));
// console.log('Show menu at position:', posX, posY);
},
hideMenu
:
function
()
{
...
...
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