Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
a-doc-editor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
a-doc-editor
Commits
c8ab7bc6
Commit
c8ab7bc6
authored
Dec 09, 2023
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
creating new page if text in the last line of the current page is too big
parent
7a2a2c90
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
a-doc-editor.js
dist/assets/a-doc-editor.js
+14
-5
No files found.
dist/assets/a-doc-editor.js
View file @
c8ab7bc6
...
@@ -252,21 +252,30 @@ var ADocEditor = function (customConfig) {
...
@@ -252,21 +252,30 @@ var ADocEditor = function (customConfig) {
let
dataBlock
=
dataSet
[
j
]
let
dataBlock
=
dataSet
[
j
]
if
(
dataBlock
.
style
.
y
-
pageYOffset
>=
config
.
pageSetup
.
canvasHeight
){
if
(
dataBlock
.
style
.
y
-
pageYOffset
>=
config
.
pageSetup
.
canvasHeight
){
pageYOffset
=
dataBlock
.
style
.
y
-
dataBlock
.
style
.
fontSize
pageYOffset
=
dataBlock
.
style
.
y
-
dataBlock
.
style
.
fontSize
;
;
// calculate and use the max Font size on the current line in the formattedText array
canvasIndex
++
;
canvasIndex
++
;
if
(
!
canvasList
[
canvasIndex
])
canvasList
[
canvasIndex
]
=
{
id
:
++
counter
,
el
:
createCanvas
(),
dataIndex
:
j
}
if
(
!
canvasList
[
canvasIndex
])
canvasList
[
canvasIndex
]
=
{
id
:
++
counter
,
el
:
createCanvas
(),
dataIndex
:
j
}
}
}
let
ctx
=
canvasList
[
canvasIndex
].
el
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
let
ctx
=
canvasList
[
canvasIndex
].
el
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
ctx
.
save
()
ctx
.
save
()
dataBlock
.
style
.
canvasIndex
=
canvasIndex
dataBlock
.
style
.
canvasIndex
=
canvasIndex
for
(
let
i
=
0
;
i
<
dataBlock
.
formatedText
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataBlock
.
formatedText
.
length
;
i
++
)
{
if
(
dataBlock
.
formatedText
[
i
].
y
-
pageYOffset
>=
config
.
pageSetup
.
canvasHeight
){
ctx
.
restore
()
pageYOffset
=
dataBlock
.
formatedText
[
i
].
y
-
dataBlock
.
style
.
fontSize
;
// calculate and use the max Font size on the current line in the formattedText array
canvasIndex
++
;
if
(
!
canvasList
[
canvasIndex
])
canvasList
[
canvasIndex
]
=
{
id
:
++
counter
,
el
:
createCanvas
(),
dataIndex
:
j
}
ctx
=
canvasList
[
canvasIndex
].
el
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
ctx
.
save
()
}
ctx
.
font
=
`
${
dataBlock
.
formatedText
[
i
].
fontSize
}
px
${
dataBlock
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
font
=
`
${
dataBlock
.
formatedText
[
i
].
fontSize
}
px
${
dataBlock
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
fillStyle
=
dataBlock
.
formatedText
[
i
].
fontColor
ctx
.
fillStyle
=
dataBlock
.
formatedText
[
i
].
fontColor
ctx
.
fillText
(
dataBlock
.
formatedText
[
i
].
char
,
dataBlock
.
formatedText
[
i
].
x
,
(
dataBlock
.
formatedText
[
i
].
y
-
pageYOffset
))
dataBlock
.
formatedText
[
i
].
canvasX
=
dataBlock
.
formatedText
[
i
].
x
dataBlock
.
formatedText
[
i
].
canvasY
=
(
dataBlock
.
formatedText
[
i
].
y
-
pageYOffset
)
ctx
.
fillText
(
dataBlock
.
formatedText
[
i
].
char
,
dataBlock
.
formatedText
[
i
].
canvasX
,
dataBlock
.
formatedText
[
i
].
canvasY
)
dataBlock
.
formatedText
[
i
].
canvasIndex
=
canvasIndex
dataBlock
.
formatedText
[
i
].
canvasIndex
=
canvasIndex
}
}
ctx
.
restore
()
ctx
.
restore
()
...
...
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