Commit 05994aa9 by ramdayalmunda

simple follow caret

parent 4a5400c4
...@@ -84,7 +84,6 @@ var ADocEditor = function (customConfig) { ...@@ -84,7 +84,6 @@ var ADocEditor = function (customConfig) {
if (dataList[i].id == caretData.activeData.id) { if (dataList[i].id == caretData.activeData.id) {
caretData.canvasIndex = canvasIndex caretData.canvasIndex = canvasIndex
caretData = { ...caretData, ...calculateCaretPosition() }
} }
} }
...@@ -94,7 +93,7 @@ var ADocEditor = function (customConfig) { ...@@ -94,7 +93,7 @@ var ADocEditor = function (customConfig) {
let ctx = canvasList[caretData.canvasIndex].getContext('2d', { willReadFrequently: true }) let ctx = canvasList[caretData.canvasIndex].getContext('2d', { willReadFrequently: true })
let rectX = caretData.x; let rectX = caretData.x;
let rectY = caretData.y-caretData.caretSize; let rectY = caretData.y-caretData.caretSize;
let rectWidth = 4; let rectWidth = 3;
let rectHeight = caretData.caretSize; let rectHeight = caretData.caretSize;
const imageData = ctx.getImageData(rectX, rectY, rectWidth, rectHeight); const imageData = ctx.getImageData(rectX, rectY, rectWidth, rectHeight);
...@@ -136,6 +135,7 @@ var ADocEditor = function (customConfig) { ...@@ -136,6 +135,7 @@ var ADocEditor = function (customConfig) {
let fontFamily = "Arial" let fontFamily = "Arial"
ctx.font = `${fontSize}px ${fontFamily}` ctx.font = `${fontSize}px ${fontFamily}`
ctx.fillStyle = `#000` ctx.fillStyle = `#000`
caretData.x = ctx.measureText(dataSet.plainContent).width
ctx.fillText(dataSet.plainContent, 0, fontSize * (3 / 4)) ctx.fillText(dataSet.plainContent, 0, fontSize * (3 / 4))
ctx.restore() ctx.restore()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment