scroller: fix some tick bug
parent
9fb2ba6d05
commit
83b217e110
|
@ -154,7 +154,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
||||||
// Get cursor px position
|
// Get cursor px position
|
||||||
const { top1, top2, y1, y2 } = this.getCoords(scroll, "y");
|
const { top1, top2, y1, y2 } = this.getCoords(scroll, "y");
|
||||||
const topfrac = (scroll - y1) / (y2 - y1);
|
const topfrac = (scroll - y1) / (y2 - y1);
|
||||||
const rtop = top1 + (top2 - top1) * topfrac;
|
const rtop = top1 + (top2 - top1) * (topfrac || 0);
|
||||||
|
|
||||||
// Always move static cursor to right position
|
// Always move static cursor to right position
|
||||||
this.cursorY = rtop;
|
this.cursorY = rtop;
|
||||||
|
@ -200,7 +200,6 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
||||||
// Ticks
|
// Ticks
|
||||||
let prevYear = 9999;
|
let prevYear = 9999;
|
||||||
let prevMonth = 0;
|
let prevMonth = 0;
|
||||||
const thisYear = new Date().getFullYear();
|
|
||||||
|
|
||||||
// Get a new tick
|
// Get a new tick
|
||||||
const getTick = (
|
const getTick = (
|
||||||
|
@ -235,8 +234,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
||||||
const dtYear = dateTaken.getUTCFullYear();
|
const dtYear = dateTaken.getUTCFullYear();
|
||||||
const dtMonth = dateTaken.getUTCMonth();
|
const dtMonth = dateTaken.getUTCMonth();
|
||||||
const isMonth = dtMonth !== prevMonth || dtYear !== prevYear;
|
const isMonth = dtMonth !== prevMonth || dtYear !== prevYear;
|
||||||
const text =
|
const text = dtYear === prevYear ? undefined : dtYear;
|
||||||
dtYear === prevYear || dtYear === thisYear ? undefined : dtYear;
|
|
||||||
this.ticks.push(getTick(row.dayId, isMonth, text));
|
this.ticks.push(getTick(row.dayId, isMonth, text));
|
||||||
|
|
||||||
prevMonth = dtMonth;
|
prevMonth = dtMonth;
|
||||||
|
@ -459,7 +457,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
const { top1, top2, y1, y2 } = this.getCoords(y, "topF");
|
const { top1, top2, y1, y2 } = this.getCoords(y, "topF");
|
||||||
const yfrac = (y - top1) / (top2 - top1);
|
const yfrac = (y - top1) / (top2 - top1);
|
||||||
const ry = y1 + (y2 - y1) * yfrac;
|
const ry = y1 + (y2 - y1) * (yfrac || 0);
|
||||||
this.recycler.scrollToPosition(ry);
|
this.recycler.scrollToPosition(ry);
|
||||||
|
|
||||||
this.handleScroll();
|
this.handleScroll();
|
||||||
|
|
Loading…
Reference in New Issue