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
a758ba09
Commit
a758ba09
authored
Oct 12, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speed up asc_getCellInfo
parent
dc071c2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
40 deletions
+51
-40
cell/api.js
cell/api.js
+1
-1
cell/view/WorkbookView.js
cell/view/WorkbookView.js
+50
-39
No files found.
cell/api.js
View file @
a758ba09
...
...
@@ -2592,7 +2592,7 @@ var editor;
// Cell interface
spreadsheet_api
.
prototype
.
asc_getCellInfo
=
function
()
{
return
this
.
wb
.
get
Worksheet
().
get
SelectionInfo
();
return
this
.
wb
.
getSelectionInfo
();
};
// Получить координаты активной ячейки
...
...
cell/view/WorkbookView.js
View file @
a758ba09
...
...
@@ -157,6 +157,7 @@
this
.
Api
=
Api
;
this
.
collaborativeEditing
=
collaborativeEditing
;
this
.
lastSendInfoRange
=
null
;
this
.
oSelectionInfo
=
null
;
this
.
canUpdateAfterShiftUp
=
false
;
// Нужно ли обновлять информацию после отпускания Shift
//----- declaration -----
...
...
@@ -846,7 +847,7 @@
return
this
.
lastSendInfoRange
.
isEqual
(
range
)
&&
this
.
lastSendInfoRangeIsSelectOnShape
===
isSelectOnShape
;
};
WorkbookView
.
prototype
.
_
onWSSelectionChanged
=
function
(
info
)
{
WorkbookView
.
prototype
.
_
updateSelectionInfo
=
function
(
info
)
{
var
ws
=
this
.
cellFormulaEnterWSOpen
?
this
.
cellFormulaEnterWSOpen
:
this
.
getWorksheet
();
this
.
lastSendInfoRange
=
ws
.
model
.
selectionRange
.
getLast
().
clone
(
true
);
this
.
lastSendInfoRangeIsSelectOnShape
=
ws
.
getSelectionShape
();
...
...
@@ -854,18 +855,23 @@
if
(
null
===
info
)
{
info
=
ws
.
getSelectionInfo
();
}
this
.
oSelectionInfo
=
info
;
};
WorkbookView
.
prototype
.
_onWSSelectionChanged
=
function
(
info
)
{
this
.
_updateSelectionInfo
(
info
);
// При редактировании ячейки не нужно пересылать изменения
if
(
this
.
input
&&
false
===
w
s
.
getCellEditMode
()
&&
c_oAscSelectionDialogType
.
None
===
this
.
selectionDialogType
)
{
if
(
this
.
input
&&
false
===
thi
s
.
getCellEditMode
()
&&
c_oAscSelectionDialogType
.
None
===
this
.
selectionDialogType
)
{
// Сами запретим заходить в строку формул, когда выделен shape
if
(
this
.
lastSendInfoRangeIsSelectOnShape
)
{
this
.
input
.
disabled
=
true
;
this
.
input
.
value
=
''
;
}
else
{
this
.
input
.
disabled
=
false
;
this
.
input
.
value
=
i
nfo
.
text
;
this
.
input
.
value
=
this
.
oSelectionI
nfo
.
text
;
}
}
this
.
handlers
.
trigger
(
"
asc_onSelectionChanged
"
,
i
nfo
);
this
.
handlers
.
trigger
(
"
asc_onSelectionChanged
"
,
this
.
oSelectionI
nfo
);
this
.
handlers
.
trigger
(
"
asc_onSelectionEnd
"
);
};
...
...
@@ -1514,7 +1520,7 @@
* @param [bLockDraw]
* @returns {WorkbookView}
*/
WorkbookView
.
prototype
.
showWorksheet
=
function
(
index
,
isResized
,
bLockDraw
)
{
WorkbookView
.
prototype
.
showWorksheet
=
function
(
index
,
isResized
,
bLockDraw
)
{
if
(
index
===
this
.
wsActive
)
{
return
this
;
}
...
...
@@ -1525,21 +1531,21 @@
var
ws
=
this
.
getWorksheet
();
// Останавливаем ввод данных в редакторе ввода. Если в режиме ввода формул, то продолжаем работать с cellEditor'ом, чтобы можно было
// выбирать ячейки для формулы
if
(
ws
.
getCellEditMode
()){
if
(
this
.
cellEditor
&&
this
.
cellEditor
.
formulaIsOperator
()
){
this
.
copyActiveSheet
=
this
.
wsActive
;
if
(
!
this
.
cellFormulaEnterWSOpen
){
this
.
cellFormulaEnterWSOpen
=
ws
;
}
else
{
ws
.
setFormulaEditMode
(
false
);
}
}
else
{
if
(
!
isResized
)
this
.
_onStopCellEditing
();
}
if
(
ws
.
getCellEditMode
())
{
if
(
this
.
cellEditor
&&
this
.
cellEditor
.
formulaIsOperator
())
{
this
.
copyActiveSheet
=
this
.
wsActive
;
if
(
!
this
.
cellFormulaEnterWSOpen
)
{
this
.
cellFormulaEnterWSOpen
=
ws
;
}
else
{
ws
.
setFormulaEditMode
(
false
);
}
}
else
{
if
(
!
isResized
)
{
this
.
_onStopCellEditing
();
}
}
}
// Делаем очистку селекта
ws
.
cleanSelection
();
this
.
stopTarget
(
ws
);
...
...
@@ -1570,28 +1576,26 @@
ws
=
this
.
getWorksheet
(
index
);
// Мы делали resize или меняли zoom, но не перерисовывали данный лист (он был не активный)
if
(
ws
.
updateResize
&&
ws
.
updateZoom
)
{
ws
.
changeZoomResize
();
}
else
if
(
ws
.
updateResize
)
{
ws
.
resize
(
true
);
}
else
if
(
ws
.
updateZoom
)
{
ws
.
changeZoom
(
true
);
}
if
(
ws
.
updateResize
&&
ws
.
updateZoom
)
{
ws
.
changeZoomResize
();
}
else
if
(
ws
.
updateResize
)
{
ws
.
resize
(
true
);
}
else
if
(
ws
.
updateZoom
)
{
ws
.
changeZoom
(
true
);
}
if
(
this
.
cellEditor
&&
this
.
cellFormulaEnterWSOpen
)
{
if
(
ws
===
this
.
cellFormulaEnterWSOpen
){
this
.
cellFormulaEnterWSOpen
.
setFormulaEditMode
(
true
);
this
.
cellEditor
.
_showCanvas
();
}
else
if
(
this
.
cellFormulaEnterWSOpen
.
getCellEditMode
()
&&
this
.
cellEditor
.
isFormula
()
)
{
this
.
cellFormulaEnterWSOpen
.
setFormulaEditMode
(
false
);
/*скрываем cellEditor, в редактор добавляем %selected sheet name%+"!" */
this
.
cellEditor
.
_hideCanvas
();
ws
.
cleanSelection
();
ws
.
setFormulaEditMode
(
true
);
}
if
(
this
.
cellEditor
&&
this
.
cellFormulaEnterWSOpen
)
{
if
(
ws
===
this
.
cellFormulaEnterWSOpen
)
{
this
.
cellFormulaEnterWSOpen
.
setFormulaEditMode
(
true
);
this
.
cellEditor
.
_showCanvas
();
}
else
if
(
this
.
cellFormulaEnterWSOpen
.
getCellEditMode
()
&&
this
.
cellEditor
.
isFormula
())
{
this
.
cellFormulaEnterWSOpen
.
setFormulaEditMode
(
false
);
/*скрываем cellEditor, в редактор добавляем %selected sheet name%+"!" */
this
.
cellEditor
.
_hideCanvas
();
ws
.
cleanSelection
();
ws
.
setFormulaEditMode
(
true
);
}
}
if
(
!
bLockDraw
)
{
ws
.
draw
();
...
...
@@ -1773,6 +1777,13 @@
this
.
wsMustDraw
=
false
;
};
WorkbookView
.
prototype
.
getSelectionInfo
=
function
()
{
if
(
!
this
.
oSelectionInfo
)
{
this
.
_updateSelectionInfo
();
}
return
this
.
oSelectionInfo
;
};
// Получаем свойство: редактируем мы сейчас или нет
WorkbookView
.
prototype
.
getCellEditMode
=
function
()
{
return
this
.
isCellEditMode
;
...
...
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