Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
v3.1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkunka committed May 14, 2017
1 parent 89e8f2a commit 4b0bebc
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 50 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"-W055": true,
"-W069": true,
"-W097": true,
"-W087": true,
"undef": true,
"unused": true,
"laxbreak": true,
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

## 3.1.11

- Various geometry improvements related to scroll bar issues on desktop Windows and (non-inertial scroll) desktop Mac systems.
- Addition of `animation.clampWidth` configuration option.

## 3.1.10

- Fixes an issue where the `activeContainerClass` did not persist between non-layout-change operations (e.g. sort, filter).
Expand Down
10 changes: 5 additions & 5 deletions demos/mixitup.min.js

Large diffs are not rendered by default.

116 changes: 95 additions & 21 deletions dist/mixitup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* MixItUp v3.1.10
* MixItUp v3.1.11
* A high-performance, dependency-free library for animated filtering, sorting and more
* Build e6e7a2d0-7eef-4170-a198-9a6a2bd4e53e
* Build df0ecdbb-7676-4e95-b437-ba1d1a4bff66
*
* @copyright Copyright 2014-2017 KunkaLabs Limited.
* @author KunkaLabs Limited.
Expand Down Expand Up @@ -1309,7 +1309,10 @@
return {
scrollTop: window.pageYOffset,
scrollLeft: window.pageXOffset,
docHeight: doc.documentElement.scrollHeight
docHeight: doc.documentElement.scrollHeight,
docWidth: doc.documentElement.scrollWidth,
viewportHeight: doc.documentElement.clientHeight,
viewportWidth: doc.documentElement.clientWidth
};
},

Expand Down Expand Up @@ -2260,6 +2263,32 @@

this.clampHeight = true;

/**
* A boolean dictating whether or not to clamp the width of the container while MixItUp's
* geometry tests are carried out before an operation.
*
* To prevent scroll-bar flicker, clamping is turned on by default. But in the case where the
* width of the container might affect its horitzontal positioning in the viewport
* (e.g. a horizontall-centered container), this should be turned off to ensure accurate
* test results and a smooth animation.
*
* @example <caption>Example: Disable container width-clamping</caption>
*
* var mixer = mixitup(containerEl, {
* animation: {
* clampWidth: false
* }
* });
*
* @name clampWidth
* @memberof mixitup.Config.animation
* @instance
* @type {boolean}
* @default true
*/

this.clampWidth = true;

this.callActions('afterConstruct');

h.seal(this);
Expand Down Expand Up @@ -6267,14 +6296,34 @@
self.config.animation.perspectiveOrigin;
}

if (self.config.animation.animateResizeContainer || operation.startHeight === operation.newHeight) {
if (
self.config.animation.animateResizeContainer &&
operation.startHeight !== operation.newHeight &&
operation.viewportDeltaY !== operation.startHeight - operation.newHeight
) {
self.dom.parent.style.height = operation.startHeight + 'px';
}

if (self.config.animation.animateResizeContainer || operation.startWidth === operation.newWidth) {
if (
self.config.animation.animateResizeContainer &&
operation.startWidth !== operation.newWidth &&
operation.viewportDeltaX !== operation.startWidth - operation.newWidth
) {
self.dom.parent.style.width = operation.startWidth + 'px';
}

if (operation.startHeight === operation.newHeight) {
self.dom.parent.style.height = operation.startHeight + 'px';
}

if (operation.startWidth === operation.newWidth) {
self.dom.parent.style.width = operation.startWidth + 'px';
}

if (operation.startHeight === operation.newHeight && operation.startWidth === operation.newWidth) {
self.dom.parent.style.overflow = 'hidden';
}

requestAnimationFrame(function() {
self.moveTargets(operation);
});
Expand Down Expand Up @@ -6356,13 +6405,18 @@

self.callActions('beforeSetInter', arguments);

// Prevent scrollbar flicker on non-inertial scroll platforms by clamping height
// Prevent scrollbar flicker on non-inertial scroll platforms by clamping height/width

if (self.config.animation.clampHeight) {
self.dom.parent.style.height = operation.startHeight + 'px';
self.dom.parent.style.overflow = 'hidden';
}

if (self.config.animation.clampWidth) {
self.dom.parent.style.width = operation.startWidth + 'px';
self.dom.parent.style.overflow = 'hidden';
}

for (i = 0; target = operation.toShow[i]; i++) {
target.show();
}
Expand Down Expand Up @@ -6416,13 +6470,6 @@

self.callActions('beforeSetFinal', arguments);

// Remove clamping

if (self.config.animation.clampHeight) {
self.dom.parent.style.height =
self.dom.parent.style.overflow = '';
}

operation.willSort && self.printSort(false, operation);

for (i = 0; target = operation.toHide[i]; i++) {
Expand All @@ -6443,14 +6490,10 @@
getFinalMixData: function(operation) {
var self = this,
parentStyle = null,
parentRect = self.dom.parent.getBoundingClientRect(),
parentRect = null,
target = null,
i = -1;

if (!self.incPadding) {
parentStyle = window.getComputedStyle(self.dom.parent);
}

self.callActions('beforeGetFinalMixData', arguments);

for (i = 0; target = operation.show[i]; i++) {
Expand All @@ -6461,6 +6504,20 @@
operation.toHidePosData[i].finalPosData = target.getPosData();
}

// Remove clamping

if (self.config.animation.clampHeight || self.config.animation.clampWidth) {
self.dom.parent.style.height =
self.dom.parent.style.width =
self.dom.parent.style.overflow = '';
}

if (!self.incPadding) {
parentStyle = window.getComputedStyle(self.dom.parent);
}

parentRect = self.dom.parent.getBoundingClientRect();

operation.newX = parentRect.left;
operation.newY = parentRect.top;

Expand All @@ -6480,6 +6537,9 @@
parseFloat(parentStyle.borderLeft) -
parseFloat(parentStyle.borderRight);

operation.viewportDeltaX = operation.docState.viewportWidth - this.dom.document.documentElement.clientWidth;
operation.viewportDeltaY = operation.docState.viewportHeight - this.dom.document.documentElement.clientHeight;

if (operation.willSort) {
self.printSort(true, operation);
}
Expand Down Expand Up @@ -6746,8 +6806,19 @@
'width ' + self.config.animation.duration + 'ms ease ';

requestAnimationFrame(function() {
self.dom.parent.style.height = operation.newHeight + 'px';
self.dom.parent.style.width = operation.newWidth + 'px';
if (
operation.startHeight !== operation.newHeight &&
operation.viewportDeltaY !== operation.startHeight - operation.newHeight
) {
self.dom.parent.style.height = operation.newHeight + 'px';
}

if (
operation.startWidth !== operation.newWidth &&
operation.viewportDeltaX !== operation.startWidth - operation.newWidth
) {
self.dom.parent.style.width = operation.newWidth + 'px';
}
});
}

Expand Down Expand Up @@ -6907,6 +6978,7 @@
self.dom.parent.style[mixitup.features.transitionProp] =
self.dom.parent.style.height =
self.dom.parent.style.width =
self.dom.parent.style.overflow =
self.dom.parent.style[mixitup.features.perspectiveProp] =
self.dom.parent.style[mixitup.features.perspectiveOriginProp] = '';

Expand Down Expand Up @@ -10016,6 +10088,8 @@
this.newFilter = null;
this.startDataset = null;
this.newDataset = null;
this.viewportDeltaX = 0;
this.viewportDeltaY = 0;
this.startX = 0;
this.startY = 0;
this.startHeight = 0;
Expand Down Expand Up @@ -10483,5 +10557,5 @@
mixitup.BaseStatic.call(mixitup.constructor);

mixitup.NAME = 'mixitup';
mixitup.CORE_VERSION = '3.1.10';
mixitup.CORE_VERSION = '3.1.11';
})(window);
10 changes: 5 additions & 5 deletions dist/mixitup.min.js

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions docs/mixitup.Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,34 @@ var mixer = mixitup(containerEl, {
}
});
```
### clampWidth




A boolean dictating whether or not to clamp the width of the container while MixItUp's
geometry tests are carried out before an operation.

To prevent scroll-bar flicker, clamping is turned on by default. But in the case where the
width of the container might affect its horitzontal positioning in the viewport
(e.g. a horizontall-centered container), this should be turned off to ensure accurate
test results and a smooth animation.


|Type | Default
|--- | ---
|`boolean`| `true`

###### Example: Disable container width-clamping

```js

var mixer = mixitup(containerEl, {
animation: {
clampWidth: false
}
});
```

<h2 id="callbacks">callbacks</h2>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mixitup",
"title": "MixItUp",
"version": "3.1.10",
"version": "3.1.11",
"description": "A high-performance, dependency-free library for animated filtering, sorting and more",
"author": "KunkaLabs Limited",
"homepage": "https://www.kunkalabs.com/mixitup/",
Expand Down
26 changes: 26 additions & 0 deletions src/config-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,32 @@ mixitup.ConfigAnimation = function() {

this.clampHeight = true;

/**
* A boolean dictating whether or not to clamp the width of the container while MixItUp's
* geometry tests are carried out before an operation.
*
* To prevent scroll-bar flicker, clamping is turned on by default. But in the case where the
* width of the container might affect its horitzontal positioning in the viewport
* (e.g. a horizontall-centered container), this should be turned off to ensure accurate
* test results and a smooth animation.
*
* @example <caption>Example: Disable container width-clamping</caption>
*
* var mixer = mixitup(containerEl, {
* animation: {
* clampWidth: false
* }
* });
*
* @name clampWidth
* @memberof mixitup.Config.animation
* @instance
* @type {boolean}
* @default true
*/

this.clampWidth = true;

this.callActions('afterConstruct');

h.seal(this);
Expand Down
5 changes: 4 additions & 1 deletion src/h.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,10 @@ h = {
return {
scrollTop: window.pageYOffset,
scrollLeft: window.pageXOffset,
docHeight: doc.documentElement.scrollHeight
docHeight: doc.documentElement.scrollHeight,
docWidth: doc.documentElement.scrollWidth,
viewportHeight: doc.documentElement.clientHeight,
viewportWidth: doc.documentElement.clientWidth
};
},

Expand Down
Loading

0 comments on commit 4b0bebc

Please sign in to comment.