Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
800e065e
Commit
800e065e
authored
Dec 06, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 33607
🐛
parent
b90efd53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
46 deletions
+44
-46
cell/view/CellEditorView.js
cell/view/CellEditorView.js
+42
-44
cell/view/StringRender.js
cell/view/StringRender.js
+2
-2
No files found.
cell/view/CellEditorView.js
View file @
800e065e
...
@@ -498,7 +498,8 @@
...
@@ -498,7 +498,8 @@
t
.
_moveCursor
(
kEndOfText
);
t
.
_moveCursor
(
kEndOfText
);
};
};
CellEditor
.
prototype
.
move
=
function
(
l
,
t
,
r
,
b
)
{
CellEditor
.
prototype
.
move
=
function
(
l
,
t
,
r
,
b
)
{
this
.
textFlags
.
wrapOnlyCE
=
false
;
this
.
sides
=
this
.
options
.
getSides
();
this
.
sides
=
this
.
options
.
getSides
();
this
.
left
=
this
.
sides
.
cellX
;
this
.
left
=
this
.
sides
.
cellX
;
this
.
top
=
this
.
sides
.
cellY
;
this
.
top
=
this
.
sides
.
cellY
;
...
@@ -506,36 +507,34 @@
...
@@ -506,36 +507,34 @@
this
.
bottom
=
this
.
sides
.
b
[
0
];
this
.
bottom
=
this
.
sides
.
b
[
0
];
// ToDo вынести в отдельную функцию
// ToDo вынести в отдельную функцию
var
canExpW
=
true
,
canExpH
=
true
,
tm
,
expW
,
expH
,
fragments
=
this
.
_getRenderFragments
();
var
canExpW
=
true
,
canExpH
=
true
,
tm
,
expW
,
expH
,
fragments
=
this
.
_getRenderFragments
();
if
(
0
<
fragments
.
length
)
{
if
(
0
<
fragments
.
length
)
{
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
while
(
expW
&&
canExpW
||
expH
&&
canExpH
)
{
while
(
expW
&&
canExpW
||
expH
&&
canExpH
)
{
if
(
expW
)
{
if
(
expW
)
{
canExpW
=
this
.
_expandWidth
();
canExpW
=
this
.
_expandWidth
();
}
}
if
(
expH
)
{
if
(
expH
)
{
canExpH
=
this
.
_expandHeight
();
canExpH
=
this
.
_expandHeight
();
}
}
if
(
!
canExpW
)
{
if
(
!
canExpW
)
{
this
.
textFlags
.
wrapText
=
true
;
this
.
textFlags
.
wrapOnlyCE
=
true
;
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
());
}
}
else
{
else
{
tm
=
this
.
textRender
.
measure
(
this
.
_getContentWidth
());
tm
=
this
.
textRender
.
measure
(
this
.
_getContentWidth
()
);
}
}
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
}
}
}
}
if
(
this
.
left
<
l
||
this
.
top
<
t
||
this
.
left
>
r
||
this
.
top
>
b
)
{
if
(
this
.
left
<
l
||
this
.
top
<
t
||
this
.
left
>
r
||
this
.
top
>
b
)
{
// hide
// hide
this
.
_hideCanvas
();
this
.
_hideCanvas
();
}
}
else
{
else
{
this
.
_adjustCanvas
();
this
.
_adjustCanvas
();
this
.
_showCanvas
();
this
.
_showCanvas
();
this
.
_renderText
();
this
.
_renderText
();
...
@@ -1109,25 +1108,24 @@
...
@@ -1109,25 +1108,24 @@
CellEditor
.
prototype
.
_draw
=
function
()
{
CellEditor
.
prototype
.
_draw
=
function
()
{
var
canExpW
=
true
,
canExpH
=
true
,
tm
,
expW
,
expH
,
fragments
=
this
.
_getRenderFragments
();
var
canExpW
=
true
,
canExpH
=
true
,
tm
,
expW
,
expH
,
fragments
=
this
.
_getRenderFragments
();
if
(
0
<
fragments
.
length
)
{
if
(
0
<
fragments
.
length
)
{
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
while
(
expW
&&
canExpW
||
expH
&&
canExpH
)
{
while
(
expW
&&
canExpW
||
expH
&&
canExpH
)
{
if
(
expW
)
{
if
(
expW
)
{
canExpW
=
this
.
_expandWidth
();
canExpW
=
this
.
_expandWidth
();
}
}
if
(
expH
)
{
if
(
expH
)
{
canExpH
=
this
.
_expandHeight
();
canExpH
=
this
.
_expandHeight
();
}
}
if
(
!
canExpW
)
{
if
(
!
canExpW
)
{
this
.
textFlags
.
wrapText
=
true
;
this
.
textFlags
.
wrapOnlyCE
=
true
;
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
());
}
}
else
{
else
{
tm
=
this
.
textRender
.
measure
(
this
.
_getContentWidth
());
tm
=
this
.
textRender
.
measure
(
this
.
_getContentWidth
()
);
}
}
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expW
=
tm
.
width
>
this
.
_getContentWidth
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
expH
=
tm
.
height
>
this
.
_getContentHeight
();
...
@@ -1139,59 +1137,59 @@
...
@@ -1139,59 +1137,59 @@
this
.
_adjustCanvas
();
this
.
_adjustCanvas
();
this
.
_showCanvas
();
this
.
_showCanvas
();
this
.
_renderText
();
this
.
_renderText
();
this
.
input
.
value
=
this
.
_getFragmentsText
(
fragments
);
this
.
input
.
value
=
this
.
_getFragmentsText
(
fragments
);
this
.
_updateCursorPosition
();
this
.
_updateCursorPosition
();
this
.
_showCursor
();
this
.
_showCursor
();
};
};
CellEditor
.
prototype
.
_update
=
function
()
{
CellEditor
.
prototype
.
_update
=
function
()
{
this
.
_updateFormulaEditMod
(
/*bIsOpen*/
false
);
this
.
_updateFormulaEditMod
(
/*bIsOpen*/
false
);
var
tm
,
canExpW
,
canExpH
,
oldLC
,
doAjust
=
false
,
fragments
=
this
.
_getRenderFragments
();
var
tm
,
canExpW
,
canExpH
,
oldLC
,
doAjust
=
false
,
fragments
=
this
.
_getRenderFragments
();
if
(
0
<
fragments
.
length
)
{
if
(
0
<
fragments
.
length
)
{
oldLC
=
this
.
textRender
.
getLinesCount
();
oldLC
=
this
.
textRender
.
getLinesCount
();
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
if
(
this
.
textRender
.
getLinesCount
()
<
oldLC
)
{
if
(
this
.
textRender
.
getLinesCount
()
<
oldLC
)
{
this
.
topLineIndex
-=
oldLC
-
this
.
textRender
.
getLinesCount
();
this
.
topLineIndex
-=
oldLC
-
this
.
textRender
.
getLinesCount
();
}
}
canExpW
=
!
this
.
textFlags
.
wrapText
;
canExpW
=
!
(
this
.
textFlags
.
wrapText
||
this
.
textFlags
.
wrapOnlyCE
)
;
while
(
tm
.
width
>
this
.
_getContentWidth
()
&&
canExpW
)
{
while
(
tm
.
width
>
this
.
_getContentWidth
()
&&
canExpW
)
{
canExpW
=
this
.
_expandWidth
();
canExpW
=
this
.
_expandWidth
();
if
(
!
canExpW
)
{
if
(
!
canExpW
)
{
this
.
textFlags
.
wrap
Text
=
true
;
this
.
textFlags
.
wrap
OnlyCE
=
true
;
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
tm
=
this
.
textRender
.
measureString
(
fragments
,
this
.
textFlags
,
this
.
_getContentWidth
()
);
}
}
doAjust
=
true
;
doAjust
=
true
;
}
}
canExpH
=
true
;
canExpH
=
true
;
while
(
tm
.
height
>
this
.
_getContentHeight
()
&&
canExpH
)
{
while
(
tm
.
height
>
this
.
_getContentHeight
()
&&
canExpH
)
{
canExpH
=
this
.
_expandHeight
();
canExpH
=
this
.
_expandHeight
();
doAjust
=
true
;
doAjust
=
true
;
}
}
if
(
this
.
textRender
.
isLastCharNL
()
&&
!
doAjust
&&
canExpH
)
{
if
(
this
.
textRender
.
isLastCharNL
()
&&
!
doAjust
&&
canExpH
)
{
var
lm
=
this
.
textRender
.
calcCharHeight
(
this
.
textRender
.
getCharsCount
()
-
1
);
var
lm
=
this
.
textRender
.
calcCharHeight
(
this
.
textRender
.
getCharsCount
()
-
1
);
if
(
tm
.
height
+
lm
.
th
>
this
.
_getContentHeight
()
)
{
if
(
tm
.
height
+
lm
.
th
>
this
.
_getContentHeight
()
)
{
this
.
_expandHeight
();
this
.
_expandHeight
();
doAjust
=
true
;
doAjust
=
true
;
}
}
}
}
}
}
if
(
doAjust
)
{
if
(
doAjust
)
{
this
.
_adjustCanvas
();
this
.
_adjustCanvas
();
}
}
this
.
_renderText
();
// вызов нужен для пересчета поля line.startX, которое используется в _updateCursorPosition
this
.
_renderText
();
// вызов нужен для пересчета поля line.startX, которое используется в _updateCursorPosition
this
.
_fireUpdated
();
// вызов нужен для обновление текста верхней строки, перед обновлением позиции курсора
this
.
_fireUpdated
();
// вызов нужен для обновление текста верхней строки, перед обновлением позиции курсора
this
.
_updateCursorPosition
(
true
);
this
.
_updateCursorPosition
(
true
);
this
.
_showCursor
();
this
.
_showCursor
();
this
.
_updateUndoRedoChanged
();
this
.
_updateUndoRedoChanged
();
if
(
window
[
'
IS_NATIVE_EDITOR
'
]
&&
!
this
.
dontUpdateText
)
{
if
(
window
[
'
IS_NATIVE_EDITOR
'
]
&&
!
this
.
dontUpdateText
)
{
window
[
'
native
'
][
'
onCellEditorChangeText
'
](
this
.
_getFragmentsText
(
this
.
options
.
fragments
)
);
window
[
'
native
'
][
'
onCellEditorChangeText
'
](
this
.
_getFragmentsText
(
this
.
options
.
fragments
)
);
}
}
};
};
...
...
cell/view/StringRender.js
View file @
800e065e
...
@@ -556,7 +556,7 @@
...
@@ -556,7 +556,7 @@
* @return {Number}
* @return {Number}
*/
*/
StringRender
.
prototype
.
_calcLineWidth
=
function
(
startPos
,
endPos
)
{
StringRender
.
prototype
.
_calcLineWidth
=
function
(
startPos
,
endPos
)
{
var
wrap
=
this
.
flags
&&
(
this
.
flags
.
wrapText
||
this
.
flags
.
wrapOnlyNL
);
var
wrap
=
this
.
flags
&&
(
this
.
flags
.
wrapText
||
this
.
flags
.
wrapOnlyNL
||
this
.
flags
.
wrapOnlyCE
);
var
isAtEnd
,
j
,
chProp
,
tw
;
var
isAtEnd
,
j
,
chProp
,
tw
;
if
(
endPos
===
undefined
||
endPos
<
0
)
{
if
(
endPos
===
undefined
||
endPos
<
0
)
{
...
@@ -813,7 +813,7 @@
...
@@ -813,7 +813,7 @@
StringRender
.
prototype
.
_measureChars
=
function
(
maxWidth
)
{
StringRender
.
prototype
.
_measureChars
=
function
(
maxWidth
)
{
var
self
=
this
;
var
self
=
this
;
var
ctx
=
this
.
drawingCtx
;
var
ctx
=
this
.
drawingCtx
;
var
wrap
=
this
.
flags
&&
this
.
flags
.
wrapText
&&
!
this
.
flags
.
isNumberFormat
;
var
wrap
=
this
.
flags
&&
(
this
.
flags
.
wrapText
||
this
.
flags
.
wrapOnlyCE
)
&&
!
this
.
flags
.
isNumberFormat
;
var
wrapNL
=
this
.
flags
&&
this
.
flags
.
wrapOnlyNL
;
var
wrapNL
=
this
.
flags
&&
this
.
flags
.
wrapOnlyNL
;
var
hasRepeats
=
false
;
var
hasRepeats
=
false
;
var
i
,
j
,
fr
,
fmt
,
text
,
p
,
p_
=
{},
pIndex
,
f
,
f_
,
eq
,
startCh
;
var
i
,
j
,
fr
,
fmt
,
text
,
p
,
p_
=
{},
pIndex
,
f
,
f_
,
eq
,
startCh
;
...
...
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