Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-ui-scrollpoint

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ui-scrollpoint - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

141

dist/scrollpoint.js
/*!
* angular-ui-scrollpoint
* https://github.com/angular-ui/ui-scrollpoint
* Version: 2.1.0 - 2016-01-11T01:57:42.457Z
* Version: 2.1.1 - 2016-02-22T01:37:49.997Z
* License: MIT

@@ -35,2 +35,3 @@ */

controller: function(){
var self = this;
this.$element = undefined;

@@ -40,2 +41,3 @@ this.$target = undefined;

this.hit = undefined;
this.edges = { top: { top: true }}; // ui-scrollpoint on top edge of element with top edge of target

@@ -51,2 +53,3 @@ this.hitEdge = undefined;

this.ready = false;
this.enabled = true;

@@ -164,3 +167,3 @@

this.edges = {};
for(var i in edges){
for(var i=0; i < edges.length; i++){
this.addEdge(edges[i]);

@@ -344,2 +347,58 @@ }

};
this.onScroll = function() {
if(!self.ready || !self.enabled){ return; }
var edgeHit = self.scrollEdgeHit();
// edgeHit >= 0 - scrollpoint is scrolled out of active view
// edgeHit < 0 - scrollpoint is in active view
// hit is toggled at the moment the scrollpoint is crossed
var fireActions = false;
if(edgeHit >= 0){
// SCROLLPOINT is OUT by edgeHit pixels
if(!self.hit){
// add the scrollpoint class
if(!self.$element.hasClass(self.scrollpointClass)){
self.$element.addClass(self.scrollpointClass);
}
fireActions = true;
self.hit = true;
}
}
else{
// SCROLLPOINT is IN by edgeHit pixels
if(self.hit || angular.isUndefined(self.hit)){
// remove the scrollpoint class
if(self.$element.hasClass(self.scrollpointClass)){
self.$element.removeClass(self.scrollpointClass);
}
fireActions = true;
self.hit = false;
}
self.cachePosition();
}
if(fireActions){
// fire the actions
if(self.actions){
for(var i=0; i < self.actions.length; i++){
self.actions[i](edgeHit, self.$element, (self.hitEdge ? self.hitEdge.scroll : undefined), (self.hitEdge ? self.hitEdge.element : undefined));
}
}
}
};
this.reset = function(){
$timeout(function(){
self.$element.removeClass(self.scrollpointClass);
self.hit = undefined;
self.hitEdge = undefined;
self.cachePosition();
self.onScroll();
});
};
},

@@ -349,4 +408,2 @@ link: function (scope, elm, attrs, Ctrl) {

var uiScrollpointTarget = Ctrl[1];
var ready = false;
var hit = false;
var absoluteParent = false;

@@ -360,3 +417,3 @@

uiScrollpoint.setScrollpoint(scrollpoint);
reset();
uiScrollpoint.reset();
});

@@ -368,3 +425,3 @@

if(scrollpointEnabled != uiScrollpoint.enabled){
reset();
uiScrollpoint.reset();
}

@@ -379,7 +436,7 @@ uiScrollpoint.enabled = scrollpointEnabled;

if(uiScrollpoint.$target){
uiScrollpoint.$target.off('scroll', onScroll);
uiScrollpoint.$target.off('scroll', uiScrollpoint.onScroll);
}
uiScrollpoint.setTarget( (!scrollpointAbsolute && uiScrollpointTarget) ? uiScrollpointTarget.$element : null);
resetTarget();
reset();
uiScrollpoint.reset();
}

@@ -401,3 +458,3 @@ absoluteParent = scrollpointAbsolute;

uiScrollpoint.setClass(scrollpointClass);
reset();
uiScrollpoint.reset();
});

@@ -417,71 +474,15 @@

uiScrollpoint.setEdges(scrollpointEdge);
reset();
uiScrollpoint.reset();
}
});
function onScroll() {
if(!ready || !uiScrollpoint.enabled){ return; }
var edgeHit = uiScrollpoint.scrollEdgeHit();
var hitEdge = uiScrollpoint.hitEdge; // which edge did scrollpoint trigger at before
// edgeHit >= 0 - scrollpoint is scrolled out of active view
// edgeHit < 0 - scrollpoint is in active view
// hit is toggled at the moment the scrollpoint is crossed
var fireActions = false;
if(edgeHit >= 0){
// SCROLLPOINT is OUT by edgeHit pixels
if(!hit){
// add the scrollpoint class
if(!elm.hasClass(uiScrollpoint.scrollpointClass)){
elm.addClass(uiScrollpoint.scrollpointClass);
}
fireActions = true;
hit = true;
}
}
else{
// SCROLLPOINT is IN by edgeHit pixels
if(hit || angular.isUndefined(hit)){
// remove the scrollpoint class
if(elm.hasClass(uiScrollpoint.scrollpointClass)){
elm.removeClass(uiScrollpoint.scrollpointClass);
}
fireActions = true;
hit = false;
}
uiScrollpoint.cachePosition();
}
if(fireActions){
// fire the actions
if(uiScrollpoint.actions){
for(var i in uiScrollpoint.actions){
uiScrollpoint.actions[i](edgeHit, elm, (hitEdge ? hitEdge.scroll : undefined), (hitEdge ? hitEdge.element : undefined));
}
}
}
}
function reset() {
$timeout(function(){
elm.removeClass(uiScrollpoint.scrollpointClass);
hit = undefined;
uiScrollpoint.hitEdge = undefined;
uiScrollpoint.cachePosition();
onScroll();
});
}
function resetTarget() {
uiScrollpoint.$target.on('scroll', onScroll);
uiScrollpoint.$target.on('scroll', uiScrollpoint.onScroll);
scope.$on('$destroy', function () {
uiScrollpoint.$target.off('scroll', onScroll);
uiScrollpoint.$target.off('scroll', uiScrollpoint.onScroll);
});
}
resetTarget();
elm.ready(function(){ ready=true; onScroll(); });
scope.$on('scrollpointShouldReset', reset);
elm.ready(function(){ uiScrollpoint.ready=true; uiScrollpoint.onScroll(); });
scope.$on('scrollpointShouldReset', uiScrollpoint.reset);
}

@@ -488,0 +489,0 @@ };

/*!
* angular-ui-scrollpoint
* https://github.com/angular-ui/ui-scrollpoint
* Version: 2.1.0 - 2016-01-11T01:57:42.457Z
* Version: 2.1.1 - 2016-02-22T01:37:49.997Z
* License: MIT
*/
!function(){"use strict";angular.module("ui.scrollpoint",[]).directive("uiScrollpoint",["$window","$timeout",function(t,e){function i(){if(angular.isDefined(t.pageYOffset))return t.pageYOffset;var e=document.compatMode&&"BackCompat"!==document.compatMode?document.documentElement:document.body;return e.scrollTop}function s(){return t.document.body.scrollHeight-t.innerHeight}function n(e){return e?t.document.body.clientHeight:t.innerHeight}return{require:["uiScrollpoint","^?uiScrollpointTarget"],controller:function(){function e(t){var i={shift:0,absolute:!1,percent:!1};if(t&&angular.isString(t))if(i.percent="%"==t.charAt(t.length-1),i.percent&&(t=t.substr(0,t.length-1)),"-"===t.charAt(0))i.absolute=i.percent,i.shift=-parseFloat(t.substr(1));else if("+"===t.charAt(0))i.absolute=i.percent,i.shift=parseFloat(t.substr(1));else{var s=parseFloat(t);!isNaN(s)&&isFinite(s)&&(i.absolute=!0,i.shift=s)}else if(angular.isNumber(t))return e(t.toString());return i}this.$element=void 0,this.$target=void 0,this.hasTarget=!1,this.edges={top:{top:!0}},this.hitEdge=void 0,this.default_edge={absolute:!1,percent:!1,shift:0},this.posCache={},this.enabled=!0,this.scrollpointClass="ui-scrollpoint",this.actions=void 0,this.addEdge=function(t,i){if(angular.isString(t))if(angular.isUndefined(i)&&(i=!0),"view"==t)this.addEdge("top","bottom"),this.addEdge("bottom","top");else{var s,n;if(angular.isObject(i))for(s in i)i[s]=i[s]===!0?!0:e(i[s]);else"top"==i||"bottom"==i?(s=i,n=e(),i={},i[s]=n):i===!0?(i={},i[t]=!0):(n=e(i),i={},i[t]=n);this.edges[t]=i}},this.addAction=function(t){t&&angular.isFunction(t)&&(angular.isUndefined(this.actions)?this.actions=[t]:-1==this.actions.indexOf(t)&&this.actions.push(t))},this.setScrollpoint=function(t){this.default_edge=e(t)},this.setClass=function(t){t||(t="ui-scrollpoint"),this.scrollpointClass=t},this.setEdges=function(t){if(angular.isString(t))this.edges={},this.addEdge(t);else if(angular.isArray(t)){this.edges={};for(var e in t)this.addEdge(t[e])}else if(angular.isObject(t)){this.edges={};for(var i in t)this.addEdge(i,t[i])}else this.edges={},this.addEdge("top")},this.setElement=function(t){this.$element=t},this.setTarget=function(e){e?(this.$target=e,this.hasTarget=!0):(this.$target=angular.element(t),this.hasTarget=!1)},this.getEdge=function(t,e){if(t&&e){if(this.edges[t]&&this.edges[t][e]&&this.edges[t][e]!==!0)return this.edges[t][e]}else if(t&&!e){if(this.edges[t])return this.edges[t];return}return this.default_edge},this.checkOffset=function(t,e,i){var s;i||(i=this.default_edge);var n="bottom"==t,o="top"==e,r="bottom"==e,l=this.getScrollOffset();n&&(l+=this.getTargetHeight());var a;return i.absolute?(a=i.percent?i.shift/100*this.getTargetScrollHeight():i.shift,n&&(a=this.getTargetContentHeight()-a,this.hasTarget&&(a+=this.getTargetHeight()))):(o?a=this.getElementTop():r&&(a=this.getElementBottom()),a+=i.shift),s=l-a,n&&(s*=-1),s},this.scrollEdgeHit=function(){var t,e,i,s,n,o,r;i=0,s={};for(o in this.edges)for(r in this.edges[o]){n=this.getEdge(o,r);var l=this.checkOffset(o,r,n);n.absolute?(angular.isUndefined(s)&&(s={}),angular.isUndefined(s[o])&&(s[o]={}),s[o][r]=l,i++):(angular.isUndefined(t)||l>t)&&(t=l,e={scroll:o,element:r})}if(i&&!e){var a=!0;t=void 0;for(o in s)for(r in s[o])i>1&&s[o][r]<0?a=!1:(angular.isUndefined(t)||s[o][r]>t)&&(t=s[o][r],e={scroll:o,element:r});a||(e=void 0,t=void 0)}return this.hitEdge=t>=0?e:void 0,t},this.getScrollOffset=function(){return this.hasTarget?this.$target[0].scrollTop:i()},this.getTargetHeight=function(){return this.hasTarget?this.$target[0].offsetHeight:n()},this.getTargetContentHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:n(!0)},this.getTargetScrollHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:s()},this.getElementTop=function(t){if(!t&&angular.isDefined(this.posCache.top))return this.posCache.top;var e=this.$element[0].getBoundingClientRect(),i=e.top+this.getScrollOffset();if(this.hasTarget){var s=this.$target[0].getBoundingClientRect();i-=s.top}return i},this.getElementBottom=function(t){return this.getElementTop(t)+this.$element[0].offsetHeight},this.cachePosition=function(){this.posCache.top=this.getElementTop(!0)}},link:function(t,i,s,n){function o(){if(c&&a.enabled){var t=a.scrollEdgeHit(),e=a.hitEdge,s=!1;if(t>=0?g||(i.hasClass(a.scrollpointClass)||i.addClass(a.scrollpointClass),s=!0,g=!0):((g||angular.isUndefined(g))&&(i.hasClass(a.scrollpointClass)&&i.removeClass(a.scrollpointClass),s=!0,g=!1),a.cachePosition()),s&&a.actions)for(var n in a.actions)a.actions[n](t,i,e?e.scroll:void 0,e?e.element:void 0)}}function r(){e(function(){i.removeClass(a.scrollpointClass),g=void 0,a.hitEdge=void 0,a.cachePosition(),o()})}function l(){a.$target.on("scroll",o),t.$on("$destroy",function(){a.$target.off("scroll",o)})}var a=n[0],h=n[1],c=!1,g=!1,u=!1;a.setElement(i),a.setTarget(h?h.$element:null),s.$observe("uiScrollpoint",function(t){a.setScrollpoint(t),r()}),s.$observe("uiScrollpointEnabled",function(e){e=t.$eval(e),e!=a.enabled&&r(),a.enabled=e}),s.$observe("uiScrollpointAbsolute",function(e){e=t.$eval(e),e!=u&&(a.$target&&a.$target.off("scroll",o),a.setTarget(!e&&h?h.$element:null),l(),r()),u=e}),s.$observe("uiScrollpointAction",function(e){var i=t.$eval(e);i&&angular.isFunction(i)&&a.addAction(i)}),s.$observe("uiScrollpointClass",function(t){i.removeClass(a.scrollpointClass),a.setClass(t),r()}),s.$observe("uiScrollpointEdge",function(e){if(e){var i=["top","bottom","view"];-1==i.indexOf(e)&&(e=t.$eval(e)),a.setEdges(e),r()}}),l(),i.ready(function(){c=!0,o()}),t.$on("scrollpointShouldReset",r)}}}]).directive("uiScrollpointTarget",[function(){return{controller:["$element",function(t){this.$element=t}]}}])}();
!function(){"use strict";angular.module("ui.scrollpoint",[]).directive("uiScrollpoint",["$window","$timeout",function(t,e){function i(){if(angular.isDefined(t.pageYOffset))return t.pageYOffset;var e=document.compatMode&&"BackCompat"!==document.compatMode?document.documentElement:document.body;return e.scrollTop}function s(){return t.document.body.scrollHeight-t.innerHeight}function n(e){return e?t.document.body.clientHeight:t.innerHeight}return{require:["uiScrollpoint","^?uiScrollpointTarget"],controller:function(){function o(t){var e={shift:0,absolute:!1,percent:!1};if(t&&angular.isString(t))if(e.percent="%"==t.charAt(t.length-1),e.percent&&(t=t.substr(0,t.length-1)),"-"===t.charAt(0))e.absolute=e.percent,e.shift=-parseFloat(t.substr(1));else if("+"===t.charAt(0))e.absolute=e.percent,e.shift=parseFloat(t.substr(1));else{var i=parseFloat(t);!isNaN(i)&&isFinite(i)&&(e.absolute=!0,e.shift=i)}else if(angular.isNumber(t))return o(t.toString());return e}var r=this;this.$element=void 0,this.$target=void 0,this.hasTarget=!1,this.hit=void 0,this.edges={top:{top:!0}},this.hitEdge=void 0,this.default_edge={absolute:!1,percent:!1,shift:0},this.posCache={},this.ready=!1,this.enabled=!0,this.scrollpointClass="ui-scrollpoint",this.actions=void 0,this.addEdge=function(t,e){if(angular.isString(t))if(angular.isUndefined(e)&&(e=!0),"view"==t)this.addEdge("top","bottom"),this.addEdge("bottom","top");else{var i,s;if(angular.isObject(e))for(i in e)e[i]=e[i]===!0?!0:o(e[i]);else"top"==e||"bottom"==e?(i=e,s=o(),e={},e[i]=s):e===!0?(e={},e[t]=!0):(s=o(e),e={},e[t]=s);this.edges[t]=e}},this.addAction=function(t){t&&angular.isFunction(t)&&(angular.isUndefined(this.actions)?this.actions=[t]:-1==this.actions.indexOf(t)&&this.actions.push(t))},this.setScrollpoint=function(t){this.default_edge=o(t)},this.setClass=function(t){t||(t="ui-scrollpoint"),this.scrollpointClass=t},this.setEdges=function(t){if(angular.isString(t))this.edges={},this.addEdge(t);else if(angular.isArray(t)){this.edges={};for(var e=0;e<t.length;e++)this.addEdge(t[e])}else if(angular.isObject(t)){this.edges={};for(var i in t)this.addEdge(i,t[i])}else this.edges={},this.addEdge("top")},this.setElement=function(t){this.$element=t},this.setTarget=function(e){e?(this.$target=e,this.hasTarget=!0):(this.$target=angular.element(t),this.hasTarget=!1)},this.getEdge=function(t,e){if(t&&e){if(this.edges[t]&&this.edges[t][e]&&this.edges[t][e]!==!0)return this.edges[t][e]}else if(t&&!e){if(this.edges[t])return this.edges[t];return}return this.default_edge},this.checkOffset=function(t,e,i){var s;i||(i=this.default_edge);var n="bottom"==t,o="top"==e,r="bottom"==e,l=this.getScrollOffset();n&&(l+=this.getTargetHeight());var a;return i.absolute?(a=i.percent?i.shift/100*this.getTargetScrollHeight():i.shift,n&&(a=this.getTargetContentHeight()-a,this.hasTarget&&(a+=this.getTargetHeight()))):(o?a=this.getElementTop():r&&(a=this.getElementBottom()),a+=i.shift),s=l-a,n&&(s*=-1),s},this.scrollEdgeHit=function(){var t,e,i,s,n,o,r;i=0,s={};for(o in this.edges)for(r in this.edges[o]){n=this.getEdge(o,r);var l=this.checkOffset(o,r,n);n.absolute?(angular.isUndefined(s)&&(s={}),angular.isUndefined(s[o])&&(s[o]={}),s[o][r]=l,i++):(angular.isUndefined(t)||l>t)&&(t=l,e={scroll:o,element:r})}if(i&&!e){var a=!0;t=void 0;for(o in s)for(r in s[o])i>1&&s[o][r]<0?a=!1:(angular.isUndefined(t)||s[o][r]>t)&&(t=s[o][r],e={scroll:o,element:r});a||(e=void 0,t=void 0)}return this.hitEdge=t>=0?e:void 0,t},this.getScrollOffset=function(){return this.hasTarget?this.$target[0].scrollTop:i()},this.getTargetHeight=function(){return this.hasTarget?this.$target[0].offsetHeight:n()},this.getTargetContentHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:n(!0)},this.getTargetScrollHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:s()},this.getElementTop=function(t){if(!t&&angular.isDefined(this.posCache.top))return this.posCache.top;var e=this.$element[0].getBoundingClientRect(),i=e.top+this.getScrollOffset();if(this.hasTarget){var s=this.$target[0].getBoundingClientRect();i-=s.top}return i},this.getElementBottom=function(t){return this.getElementTop(t)+this.$element[0].offsetHeight},this.cachePosition=function(){this.posCache.top=this.getElementTop(!0)},this.onScroll=function(){if(r.ready&&r.enabled){var t=r.scrollEdgeHit(),e=!1;if(t>=0?r.hit||(r.$element.hasClass(r.scrollpointClass)||r.$element.addClass(r.scrollpointClass),e=!0,r.hit=!0):((r.hit||angular.isUndefined(r.hit))&&(r.$element.hasClass(r.scrollpointClass)&&r.$element.removeClass(r.scrollpointClass),e=!0,r.hit=!1),r.cachePosition()),e&&r.actions)for(var i=0;i<r.actions.length;i++)r.actions[i](t,r.$element,r.hitEdge?r.hitEdge.scroll:void 0,r.hitEdge?r.hitEdge.element:void 0)}},this.reset=function(){e(function(){r.$element.removeClass(r.scrollpointClass),r.hit=void 0,r.hitEdge=void 0,r.cachePosition(),r.onScroll()})}},link:function(t,e,i,s){function n(){o.$target.on("scroll",o.onScroll),t.$on("$destroy",function(){o.$target.off("scroll",o.onScroll)})}var o=s[0],r=s[1],l=!1;o.setElement(e),o.setTarget(r?r.$element:null),i.$observe("uiScrollpoint",function(t){o.setScrollpoint(t),o.reset()}),i.$observe("uiScrollpointEnabled",function(e){e=t.$eval(e),e!=o.enabled&&o.reset(),o.enabled=e}),i.$observe("uiScrollpointAbsolute",function(e){e=t.$eval(e),e!=l&&(o.$target&&o.$target.off("scroll",o.onScroll),o.setTarget(!e&&r?r.$element:null),n(),o.reset()),l=e}),i.$observe("uiScrollpointAction",function(e){var i=t.$eval(e);i&&angular.isFunction(i)&&o.addAction(i)}),i.$observe("uiScrollpointClass",function(t){e.removeClass(o.scrollpointClass),o.setClass(t),o.reset()}),i.$observe("uiScrollpointEdge",function(e){if(e){var i=["top","bottom","view"];-1==i.indexOf(e)&&(e=t.$eval(e)),o.setEdges(e),o.reset()}}),n(),e.ready(function(){o.ready=!0,o.onScroll()}),t.$on("scrollpointShouldReset",o.reset)}}}]).directive("uiScrollpointTarget",[function(){return{controller:["$element",function(t){this.$element=t}]}}])}();
{
"name": "angular-ui-scrollpoint",
"version": "2.1.0",
"version": "2.1.1",
"author": "https://github.com/angular-ui/ui-scrollpoint/graphs/contributors",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -25,2 +25,3 @@ /**

controller: function(){
var self = this;
this.$element = undefined;

@@ -30,2 +31,3 @@ this.$target = undefined;

this.hit = undefined;
this.edges = { top: { top: true }}; // ui-scrollpoint on top edge of element with top edge of target

@@ -41,2 +43,3 @@ this.hitEdge = undefined;

this.ready = false;
this.enabled = true;

@@ -154,3 +157,3 @@

this.edges = {};
for(var i in edges){
for(var i=0; i < edges.length; i++){
this.addEdge(edges[i]);

@@ -334,2 +337,58 @@ }

};
this.onScroll = function() {
if(!self.ready || !self.enabled){ return; }
var edgeHit = self.scrollEdgeHit();
// edgeHit >= 0 - scrollpoint is scrolled out of active view
// edgeHit < 0 - scrollpoint is in active view
// hit is toggled at the moment the scrollpoint is crossed
var fireActions = false;
if(edgeHit >= 0){
// SCROLLPOINT is OUT by edgeHit pixels
if(!self.hit){
// add the scrollpoint class
if(!self.$element.hasClass(self.scrollpointClass)){
self.$element.addClass(self.scrollpointClass);
}
fireActions = true;
self.hit = true;
}
}
else{
// SCROLLPOINT is IN by edgeHit pixels
if(self.hit || angular.isUndefined(self.hit)){
// remove the scrollpoint class
if(self.$element.hasClass(self.scrollpointClass)){
self.$element.removeClass(self.scrollpointClass);
}
fireActions = true;
self.hit = false;
}
self.cachePosition();
}
if(fireActions){
// fire the actions
if(self.actions){
for(var i=0; i < self.actions.length; i++){
self.actions[i](edgeHit, self.$element, (self.hitEdge ? self.hitEdge.scroll : undefined), (self.hitEdge ? self.hitEdge.element : undefined));
}
}
}
};
this.reset = function(){
$timeout(function(){
self.$element.removeClass(self.scrollpointClass);
self.hit = undefined;
self.hitEdge = undefined;
self.cachePosition();
self.onScroll();
});
};
},

@@ -339,4 +398,2 @@ link: function (scope, elm, attrs, Ctrl) {

var uiScrollpointTarget = Ctrl[1];
var ready = false;
var hit = false;
var absoluteParent = false;

@@ -350,3 +407,3 @@

uiScrollpoint.setScrollpoint(scrollpoint);
reset();
uiScrollpoint.reset();
});

@@ -358,3 +415,3 @@

if(scrollpointEnabled != uiScrollpoint.enabled){
reset();
uiScrollpoint.reset();
}

@@ -369,7 +426,7 @@ uiScrollpoint.enabled = scrollpointEnabled;

if(uiScrollpoint.$target){
uiScrollpoint.$target.off('scroll', onScroll);
uiScrollpoint.$target.off('scroll', uiScrollpoint.onScroll);
}
uiScrollpoint.setTarget( (!scrollpointAbsolute && uiScrollpointTarget) ? uiScrollpointTarget.$element : null);
resetTarget();
reset();
uiScrollpoint.reset();
}

@@ -391,3 +448,3 @@ absoluteParent = scrollpointAbsolute;

uiScrollpoint.setClass(scrollpointClass);
reset();
uiScrollpoint.reset();
});

@@ -407,71 +464,15 @@

uiScrollpoint.setEdges(scrollpointEdge);
reset();
uiScrollpoint.reset();
}
});
function onScroll() {
if(!ready || !uiScrollpoint.enabled){ return; }
var edgeHit = uiScrollpoint.scrollEdgeHit();
var hitEdge = uiScrollpoint.hitEdge; // which edge did scrollpoint trigger at before
// edgeHit >= 0 - scrollpoint is scrolled out of active view
// edgeHit < 0 - scrollpoint is in active view
// hit is toggled at the moment the scrollpoint is crossed
var fireActions = false;
if(edgeHit >= 0){
// SCROLLPOINT is OUT by edgeHit pixels
if(!hit){
// add the scrollpoint class
if(!elm.hasClass(uiScrollpoint.scrollpointClass)){
elm.addClass(uiScrollpoint.scrollpointClass);
}
fireActions = true;
hit = true;
}
}
else{
// SCROLLPOINT is IN by edgeHit pixels
if(hit || angular.isUndefined(hit)){
// remove the scrollpoint class
if(elm.hasClass(uiScrollpoint.scrollpointClass)){
elm.removeClass(uiScrollpoint.scrollpointClass);
}
fireActions = true;
hit = false;
}
uiScrollpoint.cachePosition();
}
if(fireActions){
// fire the actions
if(uiScrollpoint.actions){
for(var i in uiScrollpoint.actions){
uiScrollpoint.actions[i](edgeHit, elm, (hitEdge ? hitEdge.scroll : undefined), (hitEdge ? hitEdge.element : undefined));
}
}
}
}
function reset() {
$timeout(function(){
elm.removeClass(uiScrollpoint.scrollpointClass);
hit = undefined;
uiScrollpoint.hitEdge = undefined;
uiScrollpoint.cachePosition();
onScroll();
});
}
function resetTarget() {
uiScrollpoint.$target.on('scroll', onScroll);
uiScrollpoint.$target.on('scroll', uiScrollpoint.onScroll);
scope.$on('$destroy', function () {
uiScrollpoint.$target.off('scroll', onScroll);
uiScrollpoint.$target.off('scroll', uiScrollpoint.onScroll);
});
}
resetTarget();
elm.ready(function(){ ready=true; onScroll(); });
scope.$on('scrollpointShouldReset', reset);
elm.ready(function(){ uiScrollpoint.ready=true; uiScrollpoint.onScroll(); });
scope.$on('scrollpointShouldReset', uiScrollpoint.reset);
}

@@ -478,0 +479,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc