Socket
Socket
Sign inDemoInstall

dynamic-marquee

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-marquee - npm Package Compare versions

Comparing version 2.3.9 to 2.3.10

42

dist/dynamic-marquee.js

@@ -414,2 +414,3 @@ (function (global, factory) {

this._waitingForItem = true;
this._askedForItem = true;
this._nextItemWouldBeTouching = startOnScreen;

@@ -545,2 +546,3 @@ this._rate = rate;

_this2._waitingForItem = false;
_this2._askedForItem = false;
_this2._pendingItem = new Item($el, _this2._direction, metadata, function () {

@@ -577,3 +579,3 @@ return _this2._tickOnRaf();

}
var maxSize = Math.max.apply(Math, _toConsumableArray(this._items.map(function (_ref7) {
var maxSize = this._items.length ? Math.max.apply(Math, _toConsumableArray(this._items.map(function (_ref7) {
var item = _ref7.item;

@@ -583,3 +585,3 @@ return item.getSize({

});
})));
}))) : 0;
if (this.windowInverseSize !== maxSize) {

@@ -701,14 +703,25 @@ this.windowInverseSize = maxSize;

_this6._$moving.appendChild(_this6._pendingItem.getContainer());
var touching = _this6._rate <= 0 ? last(_this6._items) : first(_this6._items);
if (_this6._rate <= 0) {
if (_this6._lastEffectiveRate <= 0) {
var neighbour = last(_this6._items);
var offsetIfWasTouching = neighbour ? neighbour.offset + neighbour.item.getSize() : _this6._windowOffset;
_this6._items = [].concat(_toConsumableArray(_this6._items), [{
item: _this6._pendingItem,
appendRate: _this6._rate,
offset: newItemWouldBeTouching ? touching ? touching.offset + touching.item.getSize() : _this6._windowOffset : _this6._windowOffset + containerSize
offset: newItemWouldBeTouching ? offsetIfWasTouching : Math.max(
// edge case that would happen if new item requested and synchronously provided,
// but before during that another item size increases, or if new item was provided
// when it wasn't strictly needed, which can happen if you have negative rate,
// switch to positive which requests an item, and then switch back to negative again
// and provide an item
offsetIfWasTouching, _this6._windowOffset + containerSize)
}]);
} else {
var _neighbour = first(_this6._items);
var _offsetIfWasTouching = _neighbour ? _neighbour.offset - _this6._pendingItem.getSize() : _this6._windowOffset + containerSize - _this6._pendingItem.getSize();
_this6._items = [{
item: _this6._pendingItem,
appendRate: _this6._rate,
offset: newItemWouldBeTouching ? touching ? touching.offset - _this6._pendingItem.getSize() : _this6._windowOffset + containerSize - _this6._pendingItem.getSize() : _this6._windowOffset - _this6._pendingItem.getSize()
offset: newItemWouldBeTouching ? _offsetIfWasTouching : Math.min(
// edge case that would happen if new item was provided when it wasn't strictly needed,
// which can happen if you have positive rate, switch to negative which requests an item,
// and then switch back to positive again and provide an item
_offsetIfWasTouching, _this6._windowOffset - _this6._pendingItem.getSize())
}].concat(_toConsumableArray(_this6._items));

@@ -725,4 +738,4 @@ }

var lastItem = last(_this6._items);
var _touching = _this6._rate <= 0 ? lastItem : firstItem;
if (_this6._rate <= 0 && lastItem.offset + lastItem.item.getSize() - _this6._windowOffset <= containerSize + buffer || _this6._rate > 0 && firstItem.offset - _this6._windowOffset > -1 * buffer) {
var touching = _this6._lastEffectiveRate <= 0 ? lastItem : firstItem;
if (_this6._lastEffectiveRate <= 0 && lastItem.offset + lastItem.item.getSize() - _this6._windowOffset <= containerSize + buffer || _this6._lastEffectiveRate > 0 && firstItem.offset - _this6._windowOffset > -1 * buffer) {
_this6._waitingForItem = requireNewItem = true;

@@ -734,4 +747,4 @@ // if an item is appended immediately below, it would be considered touching

nextItemTouching = justReversedRate ? null : {
$el: _touching.item.getOriginalEl(),
metadata: _touching.item.getMetadata()
$el: touching.item.getOriginalEl(),
metadata: touching.item.getMetadata()
};

@@ -746,3 +759,3 @@ }

offset = _ref9.offset;
var keep = _this6._rate < 0 ? offset + item.getSize() > _this6._windowOffset : offset < _this6._windowOffset + containerSize;
var keep = _this6._lastEffectiveRate <= 0 ? offset + item.getSize() > _this6._windowOffset : offset < _this6._windowOffset + containerSize;
if (!keep) _this6._removeItem(item);

@@ -757,3 +770,4 @@ return keep;

_this6._updateWindowInverseSize();
if (requireNewItem) {
if (requireNewItem && !_this6._askedForItem) {
_this6._askedForItem = true;
var nextItem;

@@ -760,0 +774,0 @@ _this6._onItemRequired.some(function (cb) {

{
"name": "dynamic-marquee",
"version": "2.3.9",
"version": "2.3.10",
"description": "A small library for creating marquees.",

@@ -5,0 +5,0 @@ "main": "./dist/dynamic-marquee.js",

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