Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c83bd55

Browse files
committed
fix opts.animate again
fix #3043
1 parent 6b72b23 commit c83bd55

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

doc/CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Change log
126126

127127
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
128128

129+
## 12.1.1-dev (TBD)
130+
* fix [#3043](https://github.com/gridstack/gridstack.js/issues/3043) fix `opts.animate` again
131+
132+
129133
## 12.1.1 (2024-04-28)
130134
* fix [#3038](https://github.com/gridstack/gridstack.js/pull/3038) `updateOptions()` fix opts.minRow being undefined
131135

src/gridstack.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import { DDGridStack } from './dd-gridstack';
2424
import { isTouch } from './dd-touch';
2525
import { DDManager } from './dd-manager';
26-
import { DDElementHost } from './dd-element';/** global instance */
26+
import { DDElementHost } from './dd-element'; /** global instance */
2727
const dd = new DDGridStack;
2828

2929
// export all dependent file as well to make it easier for users to just import the main file
@@ -704,7 +704,8 @@ export class GridStack {
704704

705705
// if we are loading from empty temporarily remove animation
706706
const blank = !this.engine.nodes.length;
707-
if (blank) this.setAnimation(false);
707+
const noAnim = blank && this.opts.animate;
708+
if (noAnim) this.setAnimation(false);
708709

709710
// see if any items are missing from new layout and need to be removed first
710711
if (!blank && addRemove) {
@@ -769,8 +770,7 @@ export class GridStack {
769770
delete this._ignoreLayoutsNodeChange;
770771
delete this.engine.skipCacheUpdate;
771772
prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;
772-
// delay adding animation back
773-
if (blank && this.opts?.animate) this.setAnimation(this.opts.animate, true);
773+
if (noAnim) this.setAnimation(true, true); // delay adding animation back
774774
return this;
775775
}
776776

0 commit comments

Comments
 (0)