mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-09 00:40:59 +00:00
fixes mainly for fabric on canvas: fix insertNewlineStyleObject, check if currentChar lineIndex exists; fix shiftLineStyles, delete previous lines after shifting
This commit is contained in:
parent
c71a1c2049
commit
c824c8a8da
1 changed files with 8 additions and 1 deletions
|
|
@ -557,9 +557,13 @@
|
|||
this.styles[lineIndex + 1] = { };
|
||||
}
|
||||
|
||||
var currentCharStyle = this.styles[lineIndex][charIndex - 1],
|
||||
var currentCharStyle = { },
|
||||
newLineStyles = { };
|
||||
|
||||
if(this.styles[lineIndex] && this.styles[lineIndex][charIndex - 1]) {
|
||||
currentCharStyle = this.styles[lineIndex][charIndex - 1];
|
||||
}
|
||||
|
||||
// if there's nothing after cursor,
|
||||
// we clone current char style onto the next (otherwise empty) line
|
||||
if (isEndOfLine) {
|
||||
|
|
@ -668,6 +672,9 @@
|
|||
var numericLine = parseInt(line, 10);
|
||||
if (numericLine > lineIndex) {
|
||||
this.styles[numericLine + offset] = clonedStyles[numericLine];
|
||||
if(!clonedStyles[numericLine - offset]) {
|
||||
delete this.styles[numericLine];
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO: evaluate if delete old style lines with offset -1
|
||||
|
|
|
|||
Loading…
Reference in a new issue