ngx-slimscroll
Advanced tools
Comparing version 12.1.0 to 12.2.0
@@ -114,2 +114,3 @@ (function (global, factory) { | ||
this.barVisibilityChange = new i0.EventEmitter(); | ||
this.locked = false; | ||
this.el = this.viewContainer.element.nativeElement; | ||
@@ -201,2 +202,8 @@ this.body = this.document.querySelector('body'); | ||
} | ||
else if (e.type === 'lock') { | ||
this.locked = true; | ||
} | ||
else if (e.type === 'unlock') { | ||
this.locked = false; | ||
} | ||
}; | ||
@@ -275,2 +282,5 @@ SlimScrollDirective.prototype.setStyle = function () { | ||
var _this = this; | ||
if (this.locked) { | ||
return; | ||
} | ||
var start = Date.now(); | ||
@@ -319,2 +329,5 @@ var from = this.el.scrollTop; | ||
var _this = this; | ||
if (this.locked) { | ||
return; | ||
} | ||
var delta = y; | ||
@@ -388,3 +401,3 @@ var maxTop = this.el.offsetHeight - this.bar.offsetHeight; | ||
_this.top = parseFloat(getComputedStyle(bar).top); | ||
return mousemove.pipe(operators.map(function (emove) { | ||
return mousemove.pipe(operators.filter(function () { return !_this.locked; }), operators.map(function (emove) { | ||
emove.preventDefault(); | ||
@@ -397,3 +410,3 @@ return _this.top + emove.pageY - _this.pageY; | ||
_this.top = -parseFloat(getComputedStyle(bar).top); | ||
return touchmove.pipe(operators.map(function (tmove) { | ||
return touchmove.pipe(operators.filter(function () { return !_this.locked; }), operators.map(function (tmove) { | ||
return -(_this.top + tmove.targetTouches[0].pageY - _this.pageY); | ||
@@ -400,0 +413,0 @@ }), operators.takeUntil(touchend)); |
@@ -10,2 +10,2 @@ export class SlimScrollEvent { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpbXNjcm9sbC1ldmVudC5jbGFzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zbGltc2Nyb2xsL3NyYy9saWIvc2xpbXNjcm9sbC1ldmVudC5jbGFzcy50cyJdLCJu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HwgJ2luT3V0Q3ViaWMnXG4gICAgfCAnaW5RdWFydCdcbiAgICB8ICdvdXRRdWFydCdcbiAgICB8ICdpbk91dFF1YXJ0J1xuICAgIHwgJ2luUXVpbnQnXG4gICAgfCAnb3V0UXVpbnQnXG4gICAgfCAnaW5PdXRRdWludCc7XG5cbiAgY29uc3RydWN0b3Iob2JqPzogSVNsaW1TY3JvbGxFdmVudCkge1xuICAgIHRoaXMudHlwZSA9IG9iai50eXBlO1xuICAgIHRoaXMueSA9IG9iaiAmJiBvYmoueSA/IG9iai55IDogMDtcbiAgICB0aGlzLnBlcmNlbnQgPSBvYmogJiYgb2JqLnBlcmNlbnQgPyBvYmoucGVyY2VudCA6IDA7XG4gICAgdGhpcy5kdXJhdGlvbiA9IG9iaiAmJiBvYmouZHVyYXRpb24gPyBvYmouZHVyYXRpb24gOiAwO1xuICAgIHRoaXMuZWFzaW5nID0gb2JqICYmIG9iai5lYXNpbmcgPyBvYmouZWFzaW5nIDogJ2xpbmVhcic7XG4gIH1cbn1cbiJdfQ== |
@@ -5,3 +5,3 @@ import * as i0 from '@angular/core'; | ||
import { Subscription, fromEvent, merge } from 'rxjs'; | ||
import { mergeMap, map, takeUntil } from 'rxjs/operators'; | ||
import { mergeMap, filter, map, takeUntil } from 'rxjs/operators'; | ||
@@ -90,2 +90,3 @@ class SlimScrollEvent { | ||
this.barVisibilityChange = new EventEmitter(); | ||
this.locked = false; | ||
this.el = this.viewContainer.element.nativeElement; | ||
@@ -175,2 +176,8 @@ this.body = this.document.querySelector('body'); | ||
} | ||
else if (e.type === 'lock') { | ||
this.locked = true; | ||
} | ||
else if (e.type === 'unlock') { | ||
this.locked = false; | ||
} | ||
} | ||
@@ -248,2 +255,5 @@ setStyle() { | ||
scrollTo(y, duration, easingFunc) { | ||
if (this.locked) { | ||
return; | ||
} | ||
const start = Date.now(); | ||
@@ -291,2 +301,5 @@ const from = this.el.scrollTop; | ||
scrollContent(y, isWheel, isJump) { | ||
if (this.locked) { | ||
return; | ||
} | ||
let delta = y; | ||
@@ -358,3 +371,3 @@ const maxTop = this.el.offsetHeight - this.bar.offsetHeight; | ||
this.top = parseFloat(getComputedStyle(bar).top); | ||
return mousemove.pipe(map((emove) => { | ||
return mousemove.pipe(filter(() => !this.locked), map((emove) => { | ||
emove.preventDefault(); | ||
@@ -367,3 +380,3 @@ return this.top + emove.pageY - this.pageY; | ||
this.top = -parseFloat(getComputedStyle(bar).top); | ||
return touchmove.pipe(map((tmove) => { | ||
return touchmove.pipe(filter(() => !this.locked), map((tmove) => { | ||
return -(this.top + tmove.targetTouches[0].pageY - this.pageY); | ||
@@ -370,0 +383,0 @@ }), takeUntil(touchend)); |
export interface ISlimScrollEvent { | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate'; | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate' | 'lock' | 'unlock'; | ||
y?: number; | ||
@@ -9,3 +9,3 @@ percent?: number; | ||
export declare class SlimScrollEvent implements ISlimScrollEvent { | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate'; | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate' | 'lock' | 'unlock'; | ||
y?: number; | ||
@@ -12,0 +12,0 @@ percent?: number; |
@@ -37,2 +37,3 @@ import { EventEmitter, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges, ViewContainerRef } from '@angular/core'; | ||
}; | ||
locked: boolean; | ||
constructor(viewContainer: ViewContainerRef, renderer: Renderer2, document: Document, optionsDefaults: ISlimScrollOptions); | ||
@@ -39,0 +40,0 @@ ngOnInit(): void; |
{ | ||
"name": "ngx-slimscroll", | ||
"version": "12.1.0", | ||
"version": "12.2.0", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/common": ">= 12.0.0", |
# ngx-slimscroll | ||
[![AbstruseCI](https://ci.bleenco.io/badge/9)](https://ci.bleenco.io/badge/9) | ||
***ngx-slimscroll*** is a customizable scrollbar directive for Angular2+. | ||
@@ -234,3 +232,3 @@ | ||
export interface ISlimScrollEvent { | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate'; | ||
type: 'scrollToBottom' | 'scrollToTop' | 'scrollToPercent' | 'scrollTo' | 'recalculate' | 'lock' | 'unlock'; | ||
y?: number; | ||
@@ -237,0 +235,0 @@ duration?: number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
258497
1775
260