Skip to content

Commit dd93512

Browse files
committed
layout.Cube: destroy() => move the transformation logic into removeRenderAttributes() #6699
1 parent abb1c5c commit dd93512

File tree

1 file changed

+34
-40
lines changed

1 file changed

+34
-40
lines changed

src/layout/Cube.mjs

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -285,45 +285,6 @@ class Cube extends Card {
285285
super.applyRenderAttributes()
286286
}
287287

288-
/**
289-
*
290-
*/
291-
destroy(...args) {
292-
let me = this,
293-
{container} = me,
294-
{style, vdom} = container;
295-
296-
Object.assign(style, {
297-
'--perspective': null,
298-
'--rot-x' : null,
299-
'--rot-y' : null,
300-
'--rot-z' : null,
301-
'--side-x' : null,
302-
'--side-y' : null,
303-
'--side-z' : null
304-
});
305-
306-
container.style = style;
307-
308-
vdom.cn = container.getVdomItemsRoot().cn;
309-
310-
if (me.hideInactiveCardsOnDestroy) {
311-
container.items.forEach((item, index) => {
312-
if (index < 6 && index !== me.activeIndex) {
313-
item.vdom.removeDom = true
314-
}
315-
})
316-
}
317-
318-
// override
319-
container.getVdomItemsRoot = me.#cachedVdomItemsRoot;
320-
321-
container.updateDepth = -1;
322-
container.update();
323-
324-
super.destroy(...args)
325-
}
326-
327288
nestVdom() {
328289
let me = this,
329290
{container} = me,
@@ -394,7 +355,40 @@ class Cube extends Card {
394355
*/
395356
removeRenderAttributes() {
396357
super.removeRenderAttributes();
397-
this.container.removeCls('neo-animate')
358+
359+
let me = this,
360+
{container} = me,
361+
{cls, style, vdom} = container;
362+
363+
NeoArray.remove(cls, 'neo-animate');
364+
365+
Object.assign(style, {
366+
'--perspective': null,
367+
'--rot-x' : null,
368+
'--rot-y' : null,
369+
'--rot-z' : null,
370+
'--side-x' : null,
371+
'--side-y' : null,
372+
'--side-z' : null
373+
});
374+
375+
container.set({cls, style});
376+
377+
vdom.cn = container.getVdomItemsRoot().cn;
378+
379+
if (me.hideInactiveCardsOnDestroy) {
380+
container.items.forEach((item, index) => {
381+
if (index < 6 && index !== me.activeIndex) {
382+
item.vdom.removeDom = true
383+
}
384+
})
385+
}
386+
387+
// override
388+
container.getVdomItemsRoot = me.#cachedVdomItemsRoot;
389+
390+
container.updateDepth = -1;
391+
container.update();
398392
}
399393

400394
/**

0 commit comments

Comments
 (0)