Commit 95c117d5 by ramdayalmunda

idea updated

parent b89d6638
...@@ -172,7 +172,7 @@ var ADocEditor = function (customConfig) { ...@@ -172,7 +172,7 @@ var ADocEditor = function (customConfig) {
calculateTextSizeAndPosition(canvasIndex, i) calculateTextSizeAndPosition(canvasIndex, i)
} }
renderTheLines() renderTheLines()
console.log(lines)
if (!caretData.blink && caretData.activeData) renderCaret() if (!caretData.blink && caretData.activeData) renderCaret()
......
...@@ -8,6 +8,7 @@ var defaultConfig = { ...@@ -8,6 +8,7 @@ var defaultConfig = {
height: 297, height: 297,
// these will be calculated with the abloeve value so that the content is sharp and clearly visible to the user on browser UI // these will be calculated with the abloeve value so that the content is sharp and clearly visible to the user on browser UI
canvasMultiplier: 6, // these are calculated so to ensure that the canvas rendering is always HD on any resolution.
canvasWidth: 210, canvasWidth: 210,
canvasWidth: 297, canvasWidth: 297,
}, },
...@@ -43,17 +44,20 @@ var dataType = [ ...@@ -43,17 +44,20 @@ var dataType = [
// dataSet will hold the plain data. This will help us traverse the. // dataSet will hold the plain data. This will help us traverse the.
var dataSet = [ var dataSet = [
{ {
formatedText: [],// it holds the ojects storing the style of each character
type: 0, // type 0, denotes it is plain text, type: 0, // type 0, denotes it is plain text,
tabNumber: 0, // tab number by default is zero tabNumber: 0, // tab number by default is zero
plainText: "This is the plain text. This will be used to manage and handle the caret position on the canvas UI", plainText: "This is the plain text. This will be used to manage and handle the caret position on the canvas UI",
}, },
{ {
formatedText: [], // if this is blank the default style is used from "config.style"
type: 1, // type 1, denotes it is a list, type: 1, // type 1, denotes it is a list,
listType: "", listType: "",
tabNumber: 0, // tab number by default is zero tabNumber: 0, // tab number by default is zero
plainText: "This is the first item in the list. it can be wrapped around the line if necessary" plainText: "This is the first item in the list. it can be wrapped around the line if necessary"
}, },
{ {
formatedText: [],
// this is the second item on the list because the prvious item is also a list and has the same tabNumber // this is the second item on the list because the prvious item is also a list and has the same tabNumber
type: 1, // type 1, denotes it is a list, type: 1, // type 1, denotes it is a list,
itemType: "", itemType: "",
...@@ -61,6 +65,7 @@ var dataSet = [ ...@@ -61,6 +65,7 @@ var dataSet = [
plainText: "The second item on the list is here." plainText: "The second item on the list is here."
}, },
{ {
formatedText: [],
type: 0, // this is just a blank line that is added type: 0, // this is just a blank line that is added
plainText: "", plainText: "",
}, },
...@@ -98,71 +103,34 @@ var canvasList = [ ...@@ -98,71 +103,34 @@ var canvasList = [
} }
] ]
// lines // this holds the array of each line// each element holds the styleing of each character present on tthat line // lines // this holds the array of each line //
var formattedLines = [ var lines = [
{ { // this is the 1st line
chars: [ "x": 120, // starting position of the 1st character on the line
{ "y": 150, // y coordinate of the entire line
value: "T", x: 0, y: 28, style: { "plainContent": "Hey there buddy! Can you bring these items from the groceries please. It will ",
fontSize: 70, "fontSize": 30, // fontSize of the first Character
fontFamily: 'Arial', "maxFontSize": 30, // maxFont size present in the line; Will be used when selcting texts in line and its distance from the previous line
bold: false, "dataSetIndex": 0, // it hold the index of the "dataSet"
italic: false, "charStartIndex": 0, // the index of the character in the dataSet which is 1st in the line
fontColor: "#1e1f77" "charEndIndex": 77, // the index of the character in the dataSet which is last in the line
} "type": 0, // type: it denotes the type of the line ie, paragraph, list
}, "blockStart": true, // meaning this is the first line of the long set of sentences.
{ "maxLineWidth": 1020, // width of the line after which the content would wrap to the next line
value: "h", x: 10, y: 28, style: { "canvasIndex": 0, // the index of the canvas on which this line would be rendered
fontSize: 70,
fontFamily: 'Arial',
bold: false,
italic: false,
fontColor: "#1e1f77"
}
},
{
value: "i", x: 19, y: 28, style: {
fontSize: 70,
fontFamily: 'Arial',
bold: false,
italic: false,
fontColor: "#1e1f77"
}
},
{
value: "s", x: 24, y: 28, style: {
fontSize: 70,
fontFamily: 'Arial',
bold: false,
italic: false,
fontColor: "#1e1f77"
}
},
{
value: " ", x: 30, y: 28, style: {
fontSize: 70,
fontFamily: 'Arial',
bold: false,
italic: false,
fontColor: "#1e1f77"
}
},
// and so on ...
],
x: 0, // is the x coordinate of the starting point of the line.
y: 28, // is the y coordinate of the starting point of the line.
style: {
fontSize: 28,
bold: false,
italic: false,
}, },
{ // this is the second line and so one
"x": 120,
"y": 180,
"plainContent": " be really helpfull",
"fontSize": 30,
"maxFontSize": 30,
"dataSetIndex": 0,
"charStartIndex": 77,
"charEndIndex": 96,
"maxLineWidth": 1020,
"canvasIndex": 0
} }
// /// ............
] ]
// if a character does not have a style object then, it will share the style object from the previous character.
// if a character does not have a style and is the first character of the dataSet, then the default style will be picked
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