web:Add slider call callback

This commit is contained in:
pengfei.zhou 2021-04-22 11:47:08 +08:00 committed by osborn
parent e7ced92281
commit 819feb1617
3 changed files with 34 additions and 6 deletions

View File

@ -1889,6 +1889,18 @@ class View {
} }
}); });
} }
clearAnimation(context, animation) {
return this.nativeChannel(context, "clearAnimation")(animation.id).then(() => {
this.__dirty_props__.translationX = this.translationX || 0;
this.__dirty_props__.translationY = this.translationY || 0;
this.__dirty_props__.scaleX = this.scaleX || 1;
this.__dirty_props__.scaleY = this.scaleY || 1;
this.__dirty_props__.rotation = this.rotation || 0;
});
}
cancelAnimation(context, animation) {
return this.nativeChannel(context, "cancelAnimation")(animation.id);
}
} }
__decorate$d([ __decorate$d([
Property, Property,
@ -2626,6 +2638,7 @@ class Animation {
this.changeables = new Map; this.changeables = new Map;
this.duration = 0; this.duration = 0;
this.fillMode = exports.FillMode.Forward; this.fillMode = exports.FillMode.Forward;
this.id = uniqueId("Animation");
} }
toModel() { toModel() {
const changeables = []; const changeables = [];
@ -2644,7 +2657,8 @@ class Animation {
repeatCount: this.repeatCount, repeatCount: this.repeatCount,
repeatMode: this.repeatMode, repeatMode: this.repeatMode,
fillMode: this.fillMode, fillMode: this.fillMode,
timingFunction: this.timingFunction timingFunction: this.timingFunction,
id: this.id,
}; };
} }
} }
@ -2694,13 +2708,13 @@ class TranslationAnimation extends Animation {
super(); super();
this.translationXChangeable = { this.translationXChangeable = {
key: "translationX", key: "translationX",
fromValue: 1, fromValue: 0,
toValue: 1, toValue: 0,
}; };
this.translationYChangeable = { this.translationYChangeable = {
key: "translationY", key: "translationY",
fromValue: 1, fromValue: 0,
toValue: 1, toValue: 0,
}; };
this.changeables.set("translationX", this.translationXChangeable); this.changeables.set("translationX", this.translationXChangeable);
this.changeables.set("translationY", this.translationYChangeable); this.changeables.set("translationY", this.translationYChangeable);
@ -2803,6 +2817,7 @@ class AnimationSet {
constructor() { constructor() {
this.animations = []; this.animations = [];
this._duration = 0; this._duration = 0;
this.id = uniqueId("AnimationSet");
} }
addAnimation(anim) { addAnimation(anim) {
this.animations.push(anim); this.animations.push(anim);
@ -2820,6 +2835,7 @@ class AnimationSet {
return e.toModel(); return e.toModel();
}), }),
delay: this.delay, delay: this.delay,
id: this.id,
}; };
} }
} }
@ -6829,11 +6845,17 @@ var doric_web = (function (exports, axios, sandbox) {
}); });
}; };
ret.ontouchcancel = ret.ontouchend = () => { ret.ontouchcancel = ret.ontouchend = () => {
let originInndex = currentIndex;
currentIndex = Math.round(ret.scrollLeft / ret.offsetWidth); currentIndex = Math.round(ret.scrollLeft / ret.offsetWidth);
ret.scrollTo({ ret.scrollTo({
left: currentIndex * ret.offsetWidth, left: currentIndex * ret.offsetWidth,
behavior: "smooth" behavior: "smooth"
}); });
if (originInndex !== currentIndex) {
if (this.onPageSelectedFuncId.length > 0) {
this.callJSResponse(this.onPageSelectedFuncId, currentIndex);
}
}
}; };
return ret; return ret;
} }

File diff suppressed because one or more lines are too long

View File

@ -69,11 +69,17 @@ export class DoricSliderNode extends DoricSuperNode {
}) })
} }
ret.ontouchcancel = ret.ontouchend = () => { ret.ontouchcancel = ret.ontouchend = () => {
let originInndex = currentIndex
currentIndex = Math.round(ret.scrollLeft / ret.offsetWidth) currentIndex = Math.round(ret.scrollLeft / ret.offsetWidth)
ret.scrollTo({ ret.scrollTo({
left: currentIndex * ret.offsetWidth, left: currentIndex * ret.offsetWidth,
behavior: "smooth" behavior: "smooth"
}) })
if (originInndex !== currentIndex) {
if (this.onPageSelectedFuncId.length > 0) {
this.callJSResponse(this.onPageSelectedFuncId, currentIndex)
}
}
} }
return ret return ret
} }