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
babead2c
Commit
babead2c
authored
Jan 12, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
font-size fix when moving caret
parent
3ab11020
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+9
-13
No files found.
dist/assets/a-doc-editor2.js
View file @
babead2c
...
@@ -260,7 +260,6 @@ var ADocEditor = function (customConfig) {
...
@@ -260,7 +260,6 @@ var ADocEditor = function (customConfig) {
function
calculateTextSizeAndPosition
()
{
function
calculateTextSizeAndPosition
()
{
let
d
=
0
,
c
=
0
;
let
d
=
0
,
c
=
0
;
function
getLineObj
()
{
function
getLineObj
()
{
let
newLineObj
=
{
let
newLineObj
=
{
...
config
.
style
,
...
config
.
style
,
x
:
0
,
// this is the starting point x; it will change based on the tabNumber
x
:
0
,
// this is the starting point x; it will change based on the tabNumber
...
@@ -309,6 +308,7 @@ var ADocEditor = function (customConfig) {
...
@@ -309,6 +308,7 @@ var ADocEditor = function (customConfig) {
}
}
for
(
c
=
0
;
c
<
dataBlock
.
plainContent
.
length
;
c
++
)
{
for
(
c
=
0
;
c
<
dataBlock
.
plainContent
.
length
;
c
++
)
{
let
style
=
dataBlock
?.
formatedText
?.[
c
]
let
style
=
dataBlock
?.
formatedText
?.[
c
]
lineObj
.
maxFontSize
=
(
lineObj
.
maxFontSize
<
dataBlock
?.
formatedText
?.[
c
].
fontSize
)?
dataBlock
?.
formatedText
?.[
c
].
fontSize
:
lineObj
.
maxFontSize
if
(
/
\s
/
.
test
(
dataBlock
.
plainContent
[
c
]))
{
if
(
/
\s
/
.
test
(
dataBlock
.
plainContent
[
c
]))
{
// condition to check if a blank character is found.
// condition to check if a blank character is found.
...
@@ -768,23 +768,19 @@ var ADocEditor = function (customConfig) {
...
@@ -768,23 +768,19 @@ var ADocEditor = function (customConfig) {
caretData.previousCaret = null
caretData.previousCaret = null
}
}
if (!caretData.blink) {
if (!caretData.blink) {
let x = config.format.margin * pxMmRatio
let y = (config.format.margin) * pxMmRatio
let height = config.style.fontSize * pxMmRatio * 5 / 4
let charData = caretData.activeData.formatedText[caretData.index - 1]
if (charData) {
x = charData.x + charData.width
y = charData.y - charData.fontSize * pxMmRatio
} else {
let dataIndex = dataList.findIndex(item => item.id == caretData.activeData.id)
let dataIndex = dataList.findIndex(item => item.id == caretData.activeData.id)
let lineObj = lines.find(item => item.dataIndex == dataIndex && caretData.index >= item.charStartIndex)
let lineObj = lines.find(item => item.dataIndex == dataIndex && caretData.index >= item.charStartIndex)
let x = (config.format.margin * pxMmRatio) + lineObj.tabWidth
let y = (config.format.margin) * pxMmRatio
let height = lineObj.maxFontSize * pxMmRatio * 5 / 4
let width = height / 10
let charData = caretData.activeData.formatedText[caretData.index - 1]
if (lineObj) {
if (lineObj) {
x += lineObj.tabWidth
x = (charData?(charData.x+charData.width):x)
y = lineObj.y - lineObj.maxFontSize * pxMmRatio
y = lineObj.y-(lineObj.maxFontSize*pxMmRatio)
}
}
}
let width = height / 10
const imageData = ctx.getImageData(x, y, width, height);
const imageData = ctx.getImageData(x, y, width, height);
const data = imageData.data;
const data = imageData.data;
...
...
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