Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
6eb7941b
Commit
6eb7941b
authored
Jul 07, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix performance issue
parent
edaec00e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
8 deletions
+25
-8
face.js
src/adapter/face.js
+8
-2
zoom.js
src/adapter/zoom.js
+9
-3
layout.js
src/core/layout.js
+2
-1
editor.receiver.js
src/module/editor.receiver.js
+6
-2
No files found.
src/adapter/face.js
View file @
6eb7941b
...
@@ -29,18 +29,24 @@ KM.registerToolbarUI('template theme', function(name) {
...
@@ -29,18 +29,24 @@ KM.registerToolbarUI('template theme', function(name) {
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
));
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
));
}
}
});
});
var
lastState
,
lastValue
;
//状态反射
//状态反射
me
.
on
(
'interactchange'
,
function
()
{
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
this
.
queryCommandState
(
name
),
var
state
=
this
.
queryCommandState
(
name
),
value
=
this
.
queryCommandValue
(
name
);
value
=
this
.
queryCommandValue
(
name
);
//设置按钮状态
//设置按钮状态
if
(
lastState
!=
state
)
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
if
(
value
)
{
if
(
value
&&
value
!=
lastValue
)
{
// 此处貌似性能很差,加入缓存
comboboxWidget
.
selectItemByValue
(
value
);
comboboxWidget
.
selectItemByValue
(
value
);
}
}
lastState
=
state
;
lastValue
=
value
;
});
});
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
...
...
src/adapter/zoom.js
View file @
6eb7941b
...
@@ -29,17 +29,23 @@ KM.registerToolbarUI( 'zoom', function ( name ) {
...
@@ -29,17 +29,23 @@ KM.registerToolbarUI( 'zoom', function ( name ) {
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
}
);
}
);
var
lastState
,
lastValue
;
//状态反射
//状态反射
me
.
on
(
'interactchange'
,
function
()
{
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
this
.
queryCommandState
(
name
),
var
state
=
this
.
queryCommandState
(
name
),
value
=
this
.
queryCommandValue
(
name
);
value
=
this
.
queryCommandValue
(
name
);
if
(
state
!=
lastState
)
{
//设置按钮状态
//设置按钮状态
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
if
(
value
)
{
}
if
(
value
&&
value
!=
lastValue
)
{
//设置label
//设置label
comboboxWidget
.
selectItemByLabel
(
value
+
'%'
);
comboboxWidget
.
selectItemByLabel
(
value
+
'%'
);
}
}
lastState
=
state
;
lastValue
=
value
;
}
);
}
);
//comboboxWidget.button().kmui().disabled(-1);
//comboboxWidget.button().kmui().disabled(-1);
...
...
src/core/layout.js
View file @
6eb7941b
...
@@ -209,7 +209,8 @@ kity.extendClass(Minder, {
...
@@ -209,7 +209,8 @@ kity.extendClass(Minder, {
.
start
(
node
,
duration
,
'ease'
)
.
start
(
node
,
duration
,
'ease'
)
.
on
(
'finish'
,
function
()
{
.
on
(
'finish'
,
function
()
{
// 可能性能低的时候会丢帧
// 可能性能低的时候会丢帧
setTimeout
(
function
()
{
clearTimeout
(
node
.
_lastFixTimeout
);
node
.
_lastFixTimeout
=
setTimeout
(
function
()
{
applyMatrix
(
node
,
matrix
);
applyMatrix
(
node
,
matrix
);
me
.
fire
(
'layoutfinish'
,
{
me
.
fire
(
'layoutfinish'
,
{
node
:
node
,
node
:
node
,
...
...
src/module/editor.receiver.js
View file @
6eb7941b
...
@@ -52,7 +52,11 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -52,7 +52,11 @@ Minder.Receiver = kity.createClass('Receiver', {
textShape
=
new
kity
.
Text
();
textShape
=
new
kity
.
Text
();
}
}
this
.
textShape
=
textShape
;
this
.
textShape
=
textShape
;
// techird: add cache
if
(
textShape
.
_lastContent
!=
textShape
.
getContent
())
{
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
());
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
());
textShape
.
_lastContent
=
textShape
.
getContent
();
}
return
this
;
return
this
;
},
},
setTextShapeSize
:
function
(
size
)
{
setTextShapeSize
:
function
(
size
)
{
...
@@ -132,7 +136,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -132,7 +136,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
render
();
me
.
minderNode
.
render
();
//移动光标不做layout
//移动光标不做layout
if
(
!
keymap
.
direction
[
keyCode
]){
if
(
!
keymap
.
direction
[
keyCode
]
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
metaKey
&&
orgEvt
.
ctrlKey
){
clearTimeout
(
me
.
inputTextTimer
);
clearTimeout
(
me
.
inputTextTimer
);
me
.
inputTextTimer
=
setTimeout
(
function
(){
me
.
inputTextTimer
=
setTimeout
(
function
(){
...
...
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