mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(menu): rtl gesture for menu (#11830)
* fix(menu): rtl fix for menu * disable PropertySpelling in scss-lint for this special case * Revert "disable PropertySpelling in scss-lint for this special case" This reverts commit87c3302fc2. * remove scss changes because of the conflict * Fix left (default) menu position * Revert "Fix left (default) menu position" This reverts commitf657369540. * trim down ifs * remove unnecessary this
This commit is contained in:
@@ -57,14 +57,14 @@ export class MenuContentGesture extends SlideEdgeGesture {
|
||||
}
|
||||
|
||||
onSlide(slide: SlideData, ev: any) {
|
||||
const z = (this.menu.isRightSide ? slide.min : slide.max);
|
||||
const z = (this.menu.isRightSide !== this.plt.isRTL ? slide.min : slide.max);
|
||||
const stepValue = (slide.distance / z);
|
||||
|
||||
this.menu._swipeProgress(stepValue);
|
||||
}
|
||||
|
||||
onSlideEnd(slide: SlideData, ev: any) {
|
||||
let z = (this.menu.isRightSide ? slide.min : slide.max);
|
||||
let z = (this.menu.isRightSide !== this.plt.isRTL ? slide.min : slide.max);
|
||||
const currentStepValue = (slide.distance / z);
|
||||
const velocity = slide.velocity;
|
||||
z = Math.abs(z * 0.5);
|
||||
@@ -89,7 +89,7 @@ export class MenuContentGesture extends SlideEdgeGesture {
|
||||
|
||||
getElementStartPos(slide: SlideData, ev: any) {
|
||||
const menu = this.menu;
|
||||
if (menu.isRightSide) {
|
||||
if (menu.isRightSide !== this.plt.isRTL) {
|
||||
return menu.isOpen ? slide.min : slide.max;
|
||||
}
|
||||
// left menu
|
||||
@@ -98,7 +98,7 @@ export class MenuContentGesture extends SlideEdgeGesture {
|
||||
|
||||
getSlideBoundaries(): { min: number, max: number } {
|
||||
const menu = this.menu;
|
||||
if (menu.isRightSide) {
|
||||
if (menu.isRightSide !== this.plt.isRTL) {
|
||||
return {
|
||||
min: -menu.width(),
|
||||
max: 0
|
||||
|
||||
@@ -490,10 +490,11 @@ export class Menu implements RootNode, MenuInterface, OnInit, OnDestroy {
|
||||
|
||||
// user has finished dragging the menu
|
||||
const isRightSide = this.isRightSide;
|
||||
const isRTL = this._plt.isRTL;
|
||||
const opening = !this.isOpen;
|
||||
const shouldComplete = (opening)
|
||||
? isRightSide ? shouldCompleteLeft : shouldCompleteRight
|
||||
: isRightSide ? shouldCompleteRight : shouldCompleteLeft;
|
||||
? (isRightSide !== isRTL) ? shouldCompleteLeft : shouldCompleteRight
|
||||
: (isRightSide !== isRTL) ? shouldCompleteRight : shouldCompleteLeft;
|
||||
|
||||
this._getType().setProgressEnd(shouldComplete, stepValue, velocity, (isOpen: boolean) => {
|
||||
console.debug('menu, swipeEnd', this.side);
|
||||
|
||||
Reference in New Issue
Block a user