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
68afeb34
Commit
68afeb34
authored
May 30, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved of drawing of a bounds around block-level content control.
parent
e4c3ee23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
28 deletions
+48
-28
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+18
-14
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+30
-14
No files found.
word/Editor/DocumentContent.js
View file @
68afeb34
...
...
@@ -1397,14 +1397,11 @@ CDocumentContent.prototype.Get_PageBounds = function(CurPage, Height, bForceChec
};
CDocumentContent
.
prototype
.
GetContentBounds
=
function
(
CurPage
)
{
var
oBounds
=
this
.
Get_PageBounds
(
CurPage
);
var
oPage
=
this
.
Pages
[
CurPage
];
if
(
!
oPage
)
return
oBounds
;
if
(
!
oPage
||
oPage
.
Pos
>
oPage
.
EndPos
)
return
this
.
Get_PageBounds
(
CurPage
)
;
this
.
Pos
=
0
;
this
.
EndPos
=
-
1
;
var
oBounds
=
null
;
for
(
var
nIndex
=
oPage
.
Pos
;
nIndex
<=
oPage
.
EndPos
;
++
nIndex
)
{
var
oElement
=
this
.
Content
[
nIndex
];
...
...
@@ -1412,17 +1409,24 @@ CDocumentContent.prototype.GetContentBounds = function(CurPage)
var
oElementBounds
=
oElement
.
GetContentBounds
(
nElementPageIndex
);
if
(
oElementBounds
.
Bottom
>
oBounds
.
Bottom
)
oBounds
.
Bottom
=
oElementBounds
.
Bottom
;
if
(
null
===
oBounds
)
{
oBounds
=
oElementBounds
.
Copy
();
}
else
{
if
(
oElementBounds
.
Bottom
>
oBounds
.
Bottom
)
oBounds
.
Bottom
=
oElementBounds
.
Bottom
;
if
(
oElementBounds
.
Top
<
oBounds
.
Top
)
oBounds
.
Top
=
oElementBounds
.
Top
;
if
(
oElementBounds
.
Top
<
oBounds
.
Top
)
oBounds
.
Top
=
oElementBounds
.
Top
;
if
(
oElementBounds
.
Right
>
oBounds
.
Right
)
oBounds
.
Right
=
oElementBounds
.
Right
;
if
(
oElementBounds
.
Right
>
oBounds
.
Right
)
oBounds
.
Right
=
oElementBounds
.
Right
;
if
(
oElementBounds
.
Left
<
oBounds
.
Left
)
oBounds
.
Left
=
oElementBounds
.
Left
;
if
(
oElementBounds
.
Left
<
oBounds
.
Left
)
oBounds
.
Left
=
oElementBounds
.
Left
;
}
}
return
oBounds
;
...
...
word/Editor/Paragraph.js
View file @
68afeb34
...
...
@@ -416,32 +416,48 @@ Paragraph.prototype.Get_PageBounds = function(CurPage)
};
Paragraph
.
prototype
.
GetContentBounds
=
function
(
CurPage
)
{
var
oBounds
=
this
.
Get_PageBounds
(
CurPage
).
Copy
();
var
oPage
=
this
.
Pages
[
CurPage
];
if
(
!
oPage
)
return
oBounds
;
if
(
!
oPage
||
oPage
.
StartLine
>
oPage
.
EndLine
)
return
this
.
Get_PageBounds
(
CurPage
).
Copy
()
;
var
oBounds
=
null
;
for
(
var
CurLine
=
oPage
.
StartLine
;
CurLine
<=
oPage
.
EndLine
;
++
CurLine
)
{
var
oLine
=
this
.
Lines
[
CurLine
];
var
Top
=
oLine
.
Top
+
oPage
.
Y
;
if
(
oBounds
.
Top
>
Top
)
oBounds
.
Top
=
Top
;
var
Top
=
oLine
.
Top
+
oPage
.
Y
;
var
Bottom
=
oLine
.
Bottom
+
oPage
.
Y
;
if
(
oBounds
.
Bottom
<
Bottom
)
oBounds
.
Bottom
=
Bottom
;
var
Left
=
null
,
Right
=
null
;
for
(
var
CurRange
=
0
,
RangesCount
=
oLine
.
Ranges
.
length
;
CurRange
<
RangesCount
;
++
CurRange
)
{
var
oRange
=
oLine
.
Ranges
[
CurRange
];
if
(
oBounds
.
Left
>
oRange
.
X
)
oBounds
.
Left
=
oRange
.
X
;
if
(
null
===
Left
||
Left
>
oRange
.
XVisible
)
Left
=
oRange
.
XVisible
;
if
(
null
===
Right
||
Right
<
oRange
.
XVisible
+
oRange
.
W
)
Right
=
oRange
.
XVisible
+
oRange
.
W
;
}
if
(
!
oBounds
)
{
oBounds
=
new
CDocumentBounds
(
Left
,
Top
,
Right
,
Bottom
);
}
else
{
if
(
oBounds
.
Top
>
Top
)
oBounds
.
Top
=
Top
;
if
(
oBounds
.
Bottom
<
Bottom
)
oBounds
.
Bottom
=
Bottom
;
if
(
oBounds
.
Left
>
Left
)
oBounds
.
Left
=
Left
;
if
(
oBounds
.
Right
<
oRange
.
XEnd
)
oBounds
.
Right
=
oRange
.
XEnd
;
if
(
oBounds
.
Right
<
Right
)
oBounds
.
Right
=
Right
;
}
}
...
...
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