Skip to content

Commit

Permalink
Stop animating the Dashboard widgets
Browse files Browse the repository at this point in the history
fixes #2438
  • Loading branch information
brandonkelly committed Feb 15, 2018
1 parent ba7c675 commit 517f5fe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 69 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 3.0.0-RC10.1 - 2018-02-14

### Changed
- Dashboard widgets no longer animate into place when the browser is resized.

### Removed
- Removed `craft\web\Application::getTranslatedBrowserLanguage()`.

Expand All @@ -11,6 +14,7 @@
- Fixed an error that occurred if there were any non-image files in `storage/rebrand/icon/` or `storage/rebrand/logo/`.
- Fixed an error that occurred if an SVG file without `width` and `height` attributes was uploaded as the Login Page Logo. ([#2435](https://github.com/craftcms/cms/issues/2435))
- Fixed a bug where the `defaultCpLanguage` setting was only working in some cases.
- Fixed a bug where Dashboard widgets could go freaking crazy when the browser was resized. ([#2438](https://github.com/craftcms/cms/issues/2438))

## 3.0.0-RC10 - 2018-02-13

Expand Down
40 changes: 6 additions & 34 deletions src/web/assets/cp/dist/js/Craft.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! - 2018-02-01 */
/*! - 2018-02-15 */
(function($){

/** global: Craft */
Expand Down Expand Up @@ -14432,7 +14432,6 @@ Craft.Grid = Garnish.Base.extend(
this.$items = $().add(this.$items.add(items));
this.setItems();
this.refreshCols(true, true);
$(items).velocity('finish');
},

removeItems: function(items) {
Expand All @@ -14459,7 +14458,7 @@ Craft.Grid = Garnish.Base.extend(
delete this.setItems._;
},

refreshCols: function(force, animate) {
refreshCols: function(force) {
if (this._refreshingCols) {
this._refreshColsAfterRefresh = true;
if (force) {
Expand Down Expand Up @@ -14697,27 +14696,7 @@ Craft.Grid = Garnish.Base.extend(
width: this.getItemWidthCss(this.layout.colspans[this.refreshCols._.i])
};
this.refreshCols._.css[Craft.left] = this.getItemLeftPosCss(this.layout.positions[this.refreshCols._.i]);

if (animate) {
// Get the target CSS in pixels for Velocity
this.refreshCols._.velocityCss = {
width: this.getItemWidthInPx(this.layout.colspans[this.refreshCols._.i])
};
this.refreshCols._.velocityCss[Craft.left] = this.getItemLeftPosInPx(this.layout.positions[this.refreshCols._.i]);

this.items[this.refreshCols._.i].velocity(this.refreshCols._.velocityCss, {
queue: false,
complete: (function(css) {
// Set to calc()-based width/position on complete
return function(elements) {
$(elements).css(css);
};
})(this.refreshCols._.css)
});
}
else {
this.items[this.refreshCols._.i].velocity('finish').css(this.refreshCols._.css);
}
this.items[this.refreshCols._.i].css(this.refreshCols._.css);
}

// If every item is at position 0, then let them lay out au naturel
Expand All @@ -14730,7 +14709,7 @@ Craft.Grid = Garnish.Base.extend(
this.$items.css('position', 'absolute');

// Now position the items
this.positionItems(animate);
this.positionItems();

// Update the positions as the items' heigthts change
this.addListener(this.$items, 'resize', 'onItemResize');
Expand Down Expand Up @@ -14803,7 +14782,7 @@ Craft.Grid = Garnish.Base.extend(
return true;
},

positionItems: function(animate) {
positionItems: function() {
this.positionItems._ = {};

this.positionItems._.colHeights = [];
Expand All @@ -14825,14 +14804,7 @@ Craft.Grid = Garnish.Base.extend(
this.positionItems._.top += this.settings.gutter;
}

if (animate) {
this.items[this.positionItems._.i].velocity({top: this.positionItems._.top}, {
queue: false
});
}
else {
this.items[this.positionItems._.i].velocity('finish').css('top', this.positionItems._.top);
}
this.items[this.positionItems._.i].css('top', this.positionItems._.top);

// Now add the new heights to those columns
for (this.positionItems._.col = this.layout.positions[this.positionItems._.i]; this.positionItems._.col <= this.positionItems._.endingCol; this.positionItems._.col++) {
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/js/Craft.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/js/Craft.min.js.map

Large diffs are not rendered by default.

38 changes: 5 additions & 33 deletions src/web/assets/cp/src/js/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Craft.Grid = Garnish.Base.extend(
this.$items = $().add(this.$items.add(items));
this.setItems();
this.refreshCols(true, true);
$(items).velocity('finish');
},

removeItems: function(items) {
Expand All @@ -83,7 +82,7 @@ Craft.Grid = Garnish.Base.extend(
delete this.setItems._;
},

refreshCols: function(force, animate) {
refreshCols: function(force) {
if (this._refreshingCols) {
this._refreshColsAfterRefresh = true;
if (force) {
Expand Down Expand Up @@ -321,27 +320,7 @@ Craft.Grid = Garnish.Base.extend(
width: this.getItemWidthCss(this.layout.colspans[this.refreshCols._.i])
};
this.refreshCols._.css[Craft.left] = this.getItemLeftPosCss(this.layout.positions[this.refreshCols._.i]);

if (animate) {
// Get the target CSS in pixels for Velocity
this.refreshCols._.velocityCss = {
width: this.getItemWidthInPx(this.layout.colspans[this.refreshCols._.i])
};
this.refreshCols._.velocityCss[Craft.left] = this.getItemLeftPosInPx(this.layout.positions[this.refreshCols._.i]);

this.items[this.refreshCols._.i].velocity(this.refreshCols._.velocityCss, {
queue: false,
complete: (function(css) {
// Set to calc()-based width/position on complete
return function(elements) {
$(elements).css(css);
};
})(this.refreshCols._.css)
});
}
else {
this.items[this.refreshCols._.i].velocity('finish').css(this.refreshCols._.css);
}
this.items[this.refreshCols._.i].css(this.refreshCols._.css);
}

// If every item is at position 0, then let them lay out au naturel
Expand All @@ -354,7 +333,7 @@ Craft.Grid = Garnish.Base.extend(
this.$items.css('position', 'absolute');

// Now position the items
this.positionItems(animate);
this.positionItems();

// Update the positions as the items' heigthts change
this.addListener(this.$items, 'resize', 'onItemResize');
Expand Down Expand Up @@ -427,7 +406,7 @@ Craft.Grid = Garnish.Base.extend(
return true;
},

positionItems: function(animate) {
positionItems: function() {
this.positionItems._ = {};

this.positionItems._.colHeights = [];
Expand All @@ -449,14 +428,7 @@ Craft.Grid = Garnish.Base.extend(
this.positionItems._.top += this.settings.gutter;
}

if (animate) {
this.items[this.positionItems._.i].velocity({top: this.positionItems._.top}, {
queue: false
});
}
else {
this.items[this.positionItems._.i].velocity('finish').css('top', this.positionItems._.top);
}
this.items[this.positionItems._.i].css('top', this.positionItems._.top);

// Now add the new heights to those columns
for (this.positionItems._.col = this.layout.positions[this.positionItems._.i]; this.positionItems._.col <= this.positionItems._.endingCol; this.positionItems._.col++) {
Expand Down

0 comments on commit 517f5fe

Please sign in to comment.