修改代码
This commit is contained in:
parent
b8ef4c33da
commit
16fcf932ff
@ -43,6 +43,10 @@ class Animate {
|
|||||||
return this._dispose;
|
return this._dispose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isEqual(code) {
|
||||||
|
return this._state.code == code;
|
||||||
|
}
|
||||||
|
|
||||||
animate() {
|
animate() {
|
||||||
const shape = this._state.shape;
|
const shape = this._state.shape;
|
||||||
const frameList = this._state.frameList;
|
const frameList = this._state.frameList;
|
||||||
@ -83,7 +87,7 @@ class AnimateHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
animate(state) {
|
animate(state) {
|
||||||
const animate = this._animates.find(el => el.code == state.code);
|
const animate = this._animates.find(el => el.isEqual(state.code));
|
||||||
if (animate) {
|
if (animate) {
|
||||||
animate.dispose();
|
animate.dispose();
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,11 @@ export default class StateHandle {
|
|||||||
parse(shapeFactory, state) {
|
parse(shapeFactory, state) {
|
||||||
const mapTemplate = shapeFactory.getMapTemplate();
|
const mapTemplate = shapeFactory.getMapTemplate();
|
||||||
const template = mapTemplate[state.type];
|
const template = mapTemplate[state.type];
|
||||||
const templateState = template.mapState[state.status];
|
const templateState = template.mapState[state.status]||{};
|
||||||
|
const frameList = templateState.frameList||[];
|
||||||
|
|
||||||
if (templateState.needDefault) {
|
if (templateState &&
|
||||||
|
templateState.needDefault) {
|
||||||
templateState.frameList.unshift(
|
templateState.frameList.unshift(
|
||||||
Object.entries(template.mapShape).map(el => {
|
Object.entries(template.mapShape).map(el => {
|
||||||
return { name: el[0], ...el[1][utils.defStatus]};
|
return { name: el[0], ...el[1][utils.defStatus]};
|
||||||
@ -18,18 +20,17 @@ export default class StateHandle {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(Object.entries(template.mapShape))
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
...templateState,
|
...templateState,
|
||||||
shape: shapeFactory.getShapeByCode(state.code),
|
shape: shapeFactory.getShapeByCode(state.code),
|
||||||
frameList: templateState.frameList.map(frame => {
|
frameList: frameList.map(frame => {
|
||||||
return Object.fromEntries(frame.map(el => {
|
return Object.fromEntries(frame.map(el => {
|
||||||
const mapState = template.mapShape[el.name];
|
const mapState = template.mapShape[el.name]||{};
|
||||||
|
const state = mapState[el.status]||{};
|
||||||
return [el.name, {
|
return [el.name, {
|
||||||
...el,
|
...el,
|
||||||
...mapState[el.status]
|
...state
|
||||||
}]
|
}]
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
|
@ -318,6 +318,12 @@ export default {
|
|||||||
{ status: 's1', code: '100', type: 'Device' },
|
{ status: 's1', code: '100', type: 'Device' },
|
||||||
{ status: 's2', code: '101', type: 'Device' }
|
{ status: 's2', code: '101', type: 'Device' }
|
||||||
]);
|
]);
|
||||||
|
setTimeout(e => {
|
||||||
|
this.$iscs.update([
|
||||||
|
{ status: 's0', code: '100', type: 'Device' },
|
||||||
|
{ status: 's0', code: '101', type: 'Device' },
|
||||||
|
])
|
||||||
|
}, 15000)
|
||||||
},
|
},
|
||||||
// 键盘快捷键事件
|
// 键盘快捷键事件
|
||||||
onKeyboard(hook) {
|
onKeyboard(hook) {
|
||||||
|
Loading…
Reference in New Issue
Block a user