Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #130 from IjzerenHein/develop
Browse files Browse the repository at this point in the history
v0.3.9
  • Loading branch information
IjzerenHein committed Apr 11, 2016
2 parents 5cc3340 + 07a95ad commit 1c839bc
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 57 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main": "src",
"name": "famous-flex",
"version": "0.3.7",
"version": "0.3.9",
"homepage": "https://github.com/IjzerenHein/famous-flex",
"repository": {
"type": "git",
Expand Down
45 changes: 37 additions & 8 deletions dist/famous-flex-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @copyright Gloey Apps, 2014/2015
*
* @library famous-flex
* @version 0.3.7
* @generated 10-03-2016
* @version 0.3.9
* @generated 11-04-2016
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var View = window.famous.core.View;
Expand Down Expand Up @@ -48,10 +48,10 @@ AnimationController.Animation = {
return { transform: Transform.translate(0, show ? -size[1] : size[1], 0) };
}
},
Fade: function (show, size) {
Fade: function () {
return { opacity: this && this.opacity !== undefined ? this.opacity : 0 };
},
Zoom: function (show, size) {
Zoom: function () {
var scale = this && this.scale !== undefined ? this.scale : 0.5;
return {
transform: Transform.scale(scale, scale, 1),
Expand All @@ -65,7 +65,7 @@ AnimationController.Animation = {
]
};
},
FadedZoom: function (show, size) {
FadedZoom: function (show) {
var scale = show ? this && this.showScale !== undefined ? this.showScale : 0.9 : this && this.hideScale !== undefined ? this.hideScale : 1.1;
return {
opacity: this && this.opacity !== undefined ? this.opacity : 0,
Expand Down Expand Up @@ -570,6 +570,8 @@ AnimationController.prototype.show = function (renderable, options, callback) {
item.state = ItemState.QUEUED;
_setItemOptions.call(this, item, options, callback);
_updateState.call(this);
} else if (item.state === ItemState.HIDING) {
this.abort(callback);
} else if (callback) {
callback();
}
Expand Down Expand Up @@ -660,9 +662,10 @@ AnimationController.prototype.halt = function (stopAnimation, framePerc) {
return this;
};
AnimationController.prototype.abort = function (callback) {
var item;
if (this._viewStack.length >= 2 && this._viewStack[0].state === ItemState.HIDING && this._viewStack[1].state === ItemState.SHOWING) {
var prevItem = this._viewStack[0];
var item = this._viewStack[1];
item = this._viewStack[1];
var swapSpec;
item.halted = true;
swapSpec = item.endSpec;
Expand Down Expand Up @@ -692,6 +695,25 @@ AnimationController.prototype.abort = function (callback) {
}
}.bind(this);
_resume.call(this);
} else if (this._viewStack.length === 1 && this._viewStack[0].state === ItemState.HIDING) {
item = this._viewStack[0];
item.halted = true;
swapSpec = item.endSpec;
item.endSpec = item.startSpec;
item.startSpec = swapSpec;
item.state = ItemState.SHOWING;
item.showCallback = function () {
item.showCallback = undefined;
item.state = ItemState.VISIBLE;
_updateState.call(this);
_endTransferableAnimations.call(this, item);
item.endSpec = undefined;
item.startSpec = undefined;
if (callback) {
callback();
}
}.bind(this);
_resume.call(this);
}
return this;
};
Expand Down Expand Up @@ -3018,6 +3040,11 @@ LayoutUtility.getRegisteredHelper = function (name) {
};
module.exports = LayoutUtility;
},{}],9:[function(require,module,exports){
function assert(value, message) {
if (!value) {
throw new Error(message);
}
}
function LinkedListViewSequence(items) {
if (Array.isArray(items)) {
this._ = new this.constructor.Backing(this);
Expand Down Expand Up @@ -3691,6 +3718,7 @@ function _calcBounds(size, scrollOffset) {
return;
}
}
totalHeight = (prevHeight || 0) + (nextHeight || 0);
if (this.options.alignment) {
if (enforeMinSize) {
if (nextHeight !== undefined && scrollOffset + nextHeight <= 0) {
Expand All @@ -3717,7 +3745,7 @@ function _calcBounds(size, scrollOffset) {
}
}
if (this.options.alignment) {
if (prevHeight !== undefined && scrollOffset - prevHeight >= -size[this._direction]) {
if (prevHeight !== undefined && totalHeight > size[this._direction] && scrollOffset - prevHeight >= -size[this._direction]) {
this._scroll.boundsReached = Bounds.PREV;
this._scroll.springPosition = -size[this._direction] + prevHeight;
this._scroll.springSource = SpringSource.PREVBOUNDS;
Expand Down Expand Up @@ -6745,6 +6773,7 @@ famousflex.LayoutNodeManager = require('./src/LayoutNodeManager');
famousflex.LayoutUtility = require('./src/LayoutUtility');
famousflex.ScrollController = require('./src/ScrollController');
famousflex.VirtualViewSequence = require('./src/VirtualViewSequence');
famousflex.LinkedListViewSequence = require('./src/LinkedListViewSequence');
famousflex.AnimationController = require('./src/AnimationController');

famousflex.widgets = famousflex.widgets || {};
Expand All @@ -6766,4 +6795,4 @@ famousflex.layouts.WheelLayout = require('./src/layouts/WheelLayout');
famousflex.helpers = famousflex.helpers || {};
famousflex.helpers.LayoutDockHelper = require('./src/helpers/LayoutDockHelper');

},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/ScrollController":10,"./src/VirtualViewSequence":11,"./src/helpers/LayoutDockHelper":12,"./src/layouts/CollectionLayout":13,"./src/layouts/CoverLayout":14,"./src/layouts/CubeLayout":15,"./src/layouts/GridLayout":16,"./src/layouts/HeaderFooterLayout":17,"./src/layouts/ListLayout":18,"./src/layouts/NavBarLayout":19,"./src/layouts/ProportionalLayout":20,"./src/layouts/WheelLayout":22,"./src/widgets/DatePicker":23,"./src/widgets/TabBar":25,"./src/widgets/TabBarController":26}]},{},[27]);
},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/LinkedListViewSequence":9,"./src/ScrollController":10,"./src/VirtualViewSequence":11,"./src/helpers/LayoutDockHelper":12,"./src/layouts/CollectionLayout":13,"./src/layouts/CoverLayout":14,"./src/layouts/CubeLayout":15,"./src/layouts/GridLayout":16,"./src/layouts/HeaderFooterLayout":17,"./src/layouts/ListLayout":18,"./src/layouts/NavBarLayout":19,"./src/layouts/ProportionalLayout":20,"./src/layouts/WheelLayout":22,"./src/widgets/DatePicker":23,"./src/widgets/TabBar":25,"./src/widgets/TabBarController":26}]},{},[27]);
12 changes: 6 additions & 6 deletions dist/famous-flex-global.min.js

Large diffs are not rendered by default.

63 changes: 45 additions & 18 deletions dist/famous-flex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @copyright Gloey Apps, 2014/2015
*
* @library famous-flex
* @version 0.3.7
* @generated 10-03-2016
* @version 0.3.9
* @generated 11-04-2016
*/
/**
* This Source Code is licensed under the MIT license. If a copy of the
Expand Down Expand Up @@ -314,16 +314,6 @@ define('famous-flex/LayoutUtility',['require','exports','module','famous/utiliti
/*global console*/
/*eslint no-console:0 */

/**
* @private
*/
function assert(value, message) {
if (!value) {
//debugger;
throw new Error(message);
}
}

/**
* Linked-list based implementation of a view-sequence which fixes
* several issues in the stock famo.us ViewSequence.
Expand All @@ -332,6 +322,16 @@ function assert(value, message) {
*/
define('famous-flex/LinkedListViewSequence',['require','exports','module'],function(require, exports, module) {

/**
* @private
*/
function assert(value, message) {
if (!value) {
//debugger;
throw new Error(message);
}
}

/**
* @class
* @param {Object} options Configurable options.
Expand Down Expand Up @@ -4622,6 +4622,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
return;
}
}
totalHeight = (prevHeight || 0) + (nextHeight || 0);

// 2. Check whether primary boundary has been reached
if (this.options.alignment) {
Expand Down Expand Up @@ -4654,7 +4655,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti

// 3. Check if secondary bounds has been reached
if (this.options.alignment) {
if ((prevHeight !== undefined) && ((scrollOffset - prevHeight) >= -size[this._direction])) {
if ((prevHeight !== undefined) && (totalHeight > size[this._direction]) && ((scrollOffset - prevHeight) >= -size[this._direction])) {
this._scroll.boundsReached = Bounds.PREV;
this._scroll.springPosition = -size[this._direction] + prevHeight;
this._scroll.springSource = SpringSource.PREVBOUNDS;
Expand Down Expand Up @@ -7202,20 +7203,20 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c
return {transform: Transform.translate(0, show ? -size[1] : size[1], 0)};
}
},
Fade: function(show, size) {
Fade: function(/*show, size*/) {
return {
opacity: (this && (this.opacity !== undefined)) ? this.opacity : 0
};
},
Zoom: function(show, size) {
Zoom: function(/*show, size*/) {
var scale = (this && (this.scale !== undefined)) ? this.scale : 0.5;
return {
transform: Transform.scale(scale, scale, 1),
align: [0.5, 0.5],
origin: [0.5, 0.5]
};
},
FadedZoom: function(show, size) {
FadedZoom: function(show /*, size*/) {
var scale = show ? ((this && (this.showScale !== undefined)) ? this.showScale : 0.9) : ((this && (this.hideScale !== undefined)) ? this.hideScale : 1.1);
return {
opacity: (this && (this.opacity !== undefined)) ? this.opacity : 0,
Expand Down Expand Up @@ -7851,6 +7852,9 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c
_setItemOptions.call(this, item, options, callback);
_updateState.call(this);
}
else if (item.state === ItemState.HIDING) {
this.abort(callback);
}
else if (callback) {
callback();
}
Expand Down Expand Up @@ -7971,9 +7975,10 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c
* @return {AnimationController} this
*/
AnimationController.prototype.abort = function(callback) {
var item;
if ((this._viewStack.length >= 2) && (this._viewStack[0].state === ItemState.HIDING) && (this._viewStack[1].state === ItemState.SHOWING)) {
var prevItem = this._viewStack[0];
var item = this._viewStack[1];
item = this._viewStack[1];
var swapSpec;

item.halted = true;
Expand Down Expand Up @@ -8007,6 +8012,27 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c

_resume.call(this);
}
else if ((this._viewStack.length === 1) && (this._viewStack[0].state === ItemState.HIDING)) {
item = this._viewStack[0];
item.halted = true;
swapSpec = item.endSpec;
item.endSpec = item.startSpec;
item.startSpec = swapSpec;
item.state = ItemState.SHOWING;
item.showCallback = function() {
item.showCallback = undefined;
item.state = ItemState.VISIBLE;
_updateState.call(this);
_endTransferableAnimations.call(this, item);
item.endSpec = undefined;
item.startSpec = undefined;
if (callback) {
callback();
}
}.bind(this);

_resume.call(this);
}
return this;
};

Expand Down Expand Up @@ -10630,7 +10656,7 @@ define('famous-flex/layouts/NavBarLayout',['require','exports','module','../help
};
});

define('template.js',['require','famous-flex/FlexScrollView','famous-flex/FlowLayoutNode','famous-flex/LayoutContext','famous-flex/LayoutController','famous-flex/LayoutNode','famous-flex/LayoutNodeManager','famous-flex/LayoutUtility','famous-flex/ScrollController','famous-flex/VirtualViewSequence','famous-flex/AnimationController','famous-flex/widgets/DatePicker','famous-flex/widgets/TabBar','famous-flex/widgets/TabBarController','famous-flex/layouts/CollectionLayout','famous-flex/layouts/CoverLayout','famous-flex/layouts/CubeLayout','famous-flex/layouts/GridLayout','famous-flex/layouts/HeaderFooterLayout','famous-flex/layouts/ListLayout','famous-flex/layouts/NavBarLayout','famous-flex/layouts/ProportionalLayout','famous-flex/layouts/WheelLayout','famous-flex/helpers/LayoutDockHelper'],function(require) {
define('template.js',['require','famous-flex/FlexScrollView','famous-flex/FlowLayoutNode','famous-flex/LayoutContext','famous-flex/LayoutController','famous-flex/LayoutNode','famous-flex/LayoutNodeManager','famous-flex/LayoutUtility','famous-flex/ScrollController','famous-flex/VirtualViewSequence','famous-flex/LinkedListViewSequence','famous-flex/AnimationController','famous-flex/widgets/DatePicker','famous-flex/widgets/TabBar','famous-flex/widgets/TabBarController','famous-flex/layouts/CollectionLayout','famous-flex/layouts/CoverLayout','famous-flex/layouts/CubeLayout','famous-flex/layouts/GridLayout','famous-flex/layouts/HeaderFooterLayout','famous-flex/layouts/ListLayout','famous-flex/layouts/NavBarLayout','famous-flex/layouts/ProportionalLayout','famous-flex/layouts/WheelLayout','famous-flex/helpers/LayoutDockHelper'],function(require) {
require('famous-flex/FlexScrollView');
require('famous-flex/FlowLayoutNode');
require('famous-flex/LayoutContext');
Expand All @@ -10640,6 +10666,7 @@ define('template.js',['require','famous-flex/FlexScrollView','famous-flex/FlowLa
require('famous-flex/LayoutUtility');
require('famous-flex/ScrollController');
require('famous-flex/VirtualViewSequence');
require('famous-flex/LinkedListViewSequence');
require('famous-flex/AnimationController');

require('famous-flex/widgets/DatePicker');
Expand Down
12 changes: 6 additions & 6 deletions dist/famous-flex.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "famous-flex",
"version": "0.3.7",
"version": "0.3.9",
"homepage": "https://github.com/IjzerenHein/famous-flex",
"repository": {
"type": "git",
Expand Down
33 changes: 29 additions & 4 deletions src/AnimationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ define(function(require, exports, module) {
return {transform: Transform.translate(0, show ? -size[1] : size[1], 0)};
}
},
Fade: function(show, size) {
Fade: function(/*show, size*/) {
return {
opacity: (this && (this.opacity !== undefined)) ? this.opacity : 0
};
},
Zoom: function(show, size) {
Zoom: function(/*show, size*/) {
var scale = (this && (this.scale !== undefined)) ? this.scale : 0.5;
return {
transform: Transform.scale(scale, scale, 1),
align: [0.5, 0.5],
origin: [0.5, 0.5]
};
},
FadedZoom: function(show, size) {
FadedZoom: function(show /*, size*/) {
var scale = show ? ((this && (this.showScale !== undefined)) ? this.showScale : 0.9) : ((this && (this.hideScale !== undefined)) ? this.hideScale : 1.1);
return {
opacity: (this && (this.opacity !== undefined)) ? this.opacity : 0,
Expand Down Expand Up @@ -725,6 +725,9 @@ define(function(require, exports, module) {
_setItemOptions.call(this, item, options, callback);
_updateState.call(this);
}
else if (item.state === ItemState.HIDING) {
this.abort(callback);
}
else if (callback) {
callback();
}
Expand Down Expand Up @@ -845,9 +848,10 @@ define(function(require, exports, module) {
* @return {AnimationController} this
*/
AnimationController.prototype.abort = function(callback) {
var item;
if ((this._viewStack.length >= 2) && (this._viewStack[0].state === ItemState.HIDING) && (this._viewStack[1].state === ItemState.SHOWING)) {
var prevItem = this._viewStack[0];
var item = this._viewStack[1];
item = this._viewStack[1];
var swapSpec;

item.halted = true;
Expand Down Expand Up @@ -881,6 +885,27 @@ define(function(require, exports, module) {

_resume.call(this);
}
else if ((this._viewStack.length === 1) && (this._viewStack[0].state === ItemState.HIDING)) {
item = this._viewStack[0];
item.halted = true;
swapSpec = item.endSpec;
item.endSpec = item.startSpec;
item.startSpec = swapSpec;
item.state = ItemState.SHOWING;
item.showCallback = function() {
item.showCallback = undefined;
item.state = ItemState.VISIBLE;
_updateState.call(this);
_endTransferableAnimations.call(this, item);
item.endSpec = undefined;
item.startSpec = undefined;
if (callback) {
callback();
}
}.bind(this);

_resume.call(this);
}
return this;
};

Expand Down
Loading

0 comments on commit 1c839bc

Please sign in to comment.