Commit 2c622f30 by Иван Кубота

slider heighter

parent b69c2994
import { AsyncAuthAjax } from "./Ajax";
import { API } from "../dict/Consts";
Model.cards.getArray = function() {
const out = [];
let categoryItems;
for(let categoryID in this._props){
if(categoryID !== '_VERSION_'){
categoryItems = this._props[categoryID]
for(let id in categoryItems){
out.push(categoryItems[id]);
}
}
}
return out;
};
store.sub('navigation.current', (val)=>tmpStore.set('navigation.current', val));
store.sub(['navigation.current', 'loaded.cards'], async function(page, loaded) {
......
......@@ -126,6 +126,23 @@ const Model = {
history: history
};
Model.cards.getArray = function() {
const out = [];
let categoryItems;
for(let categoryID in this._props){
if(!this._props.hasOwnProperty(categoryID))
continue;
if(categoryID !== '_VERSION_'){
categoryItems = this._props[categoryID];
for(let id in categoryItems){
out.push(categoryItems[id]);
}
}
}
return out;
};
categories.loading = {};
const AsyncResourceLoaderQueue = function(cfg) {
......
......@@ -109,6 +109,10 @@ const CardSlider = (function(){
let firstItem = Math.round( fromLeft / ( this.preset.cardWidth + this.world.padding ));
this.leftButtonDisabled.set(firstItem===0);
this.rightButtonDisabled.set(firstItem+this.world.fullCardsCount>=this.items.length);
if(this.cfg.setOuterHeight){
this.scroller.style.height = ( this.hash[ firstItem ].dom.clientHeight + 40 ) + 'px';
}
//console.log(this.leftButtonDisabled.get(), this.rightButtonDisabled.get())
},
untune: function() {
......@@ -200,6 +204,7 @@ const CardSlider = (function(){
let {lastFrom, lastTo, last} = this;
let {cardWidth} = this.preset;
let {padding} = this.world;
let {setOuterHeight} = this.cfg;
let from = Math.floor(scroller.scrollLeft / (cardWidth + padding) - 1),
count = Math.ceil(scroller.clientWidth / (cardWidth + padding)),
......@@ -239,7 +244,9 @@ const CardSlider = (function(){
}
}
this.lastFrom = from;
if(from !== lastFrom){
this.lastFrom = from;
}
this.lastTo = to;
this.last = true;
this.updateButtonsState();
......
......@@ -13,6 +13,8 @@ const PaginationSliderSingleton = function(){
});
let Slider = new CardSlider( {
setOuterHeight: true,
name: "standardSlider",
tpl: StandardCard,
preset: {
......
......@@ -40,7 +40,6 @@ const Account = D.declare('view.page.Account', () => {
);
let Slider = new CardSlider( {
tpl: function (item, itemClick, n) {
return <div className="card-slider__item">
<Card
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment