Browse Source

Fix media viewer escape closing

master
Eduard Kuzmenko 4 years ago
parent
commit
366c78d4cc
  1. 24
      src/components/appMediaViewer.ts
  2. 31
      src/scss/partials/_leftSidebar.scss

24
src/components/appMediaViewer.ts

@ -1,7 +1,7 @@
import { deferredPromise } from "../helpers/cancellablePromise"; import { deferredPromise } from "../helpers/cancellablePromise";
import mediaSizes from "../helpers/mediaSizes"; import mediaSizes from "../helpers/mediaSizes";
import { isTouchSupported } from "../helpers/touchSupport"; import { isTouchSupported } from "../helpers/touchSupport";
import { isSafari } from "../helpers/userAgent"; import { isMobileSafari, isSafari } from "../helpers/userAgent";
import appDocsManager, { MyDocument } from "../lib/appManagers/appDocsManager"; import appDocsManager, { MyDocument } from "../lib/appManagers/appDocsManager";
import appImManager from "../lib/appManagers/appImManager"; import appImManager from "../lib/appManagers/appImManager";
import appMessagesManager from "../lib/appManagers/appMessagesManager"; import appMessagesManager from "../lib/appManagers/appMessagesManager";
@ -28,6 +28,7 @@ import SwipeHandler from "./swipeHandler";
import { months, ONE_DAY } from "../helpers/date"; import { months, ONE_DAY } from "../helpers/date";
import { SearchSuperContext } from "./appSearchSuper."; import { SearchSuperContext } from "./appSearchSuper.";
import DEBUG from "../config/debug"; import DEBUG from "../config/debug";
import appNavigationController from "./appNavigationController";
// TODO: масштабирование картинок (не SVG) при ресайзе, и правильный возврат на исходную позицию // TODO: масштабирование картинок (не SVG) при ресайзе, и правильный возврат на исходную позицию
// TODO: картинки "обрезаются" если возвращаются или появляются с места, где есть их перекрытие (топбар, поле ввода) // TODO: картинки "обрезаются" если возвращаются или появляются с места, где есть их перекрытие (топбар, поле ввода)
@ -238,6 +239,8 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
if(this.setMoverAnimationPromise) return; if(this.setMoverAnimationPromise) return;
appNavigationController.removeByType('media');
this.lazyLoadQueue.clear(); this.lazyLoadQueue.clear();
const promise = this.setMoverToTarget(this.lastTarget, true).then(({onAnimationEnd}) => onAnimationEnd); const promise = this.setMoverToTarget(this.lastTarget, true).then(({onAnimationEnd}) => onAnimationEnd);
@ -302,12 +305,10 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
} }
}; };
onKeyDown = (e: KeyboardEvent) => { private onKeyDown = (e: KeyboardEvent) => {
//this.log('onKeyDown', e); //this.log('onKeyDown', e);
if(e.key === 'Escape') { if(e.key === 'ArrowRight') {
this.close();
} else if(e.key === 'ArrowRight') {
this.buttons.next.click(); this.buttons.next.click();
} else if(e.key === 'ArrowLeft') { } else if(e.key === 'ArrowLeft') {
this.buttons.prev.click(); this.buttons.prev.click();
@ -883,6 +884,19 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
this.wholeDiv.classList.add('active'); this.wholeDiv.classList.add('active');
rootScope.overlayIsActive = true; rootScope.overlayIsActive = true;
animationIntersector.checkAnimations(true); animationIntersector.checkAnimations(true);
if(!isMobileSafari) {
appNavigationController.pushItem({
type: 'media',
onPop: (canAnimate) => {
if(this.setMoverAnimationPromise) {
return false;
}
this.close();
}
});
}
} }
////////this.log('wasActive:', wasActive); ////////this.log('wasActive:', wasActive);

31
src/scss/partials/_leftSidebar.scss

@ -824,13 +824,17 @@
.sidebar-left { .sidebar-left {
&-section { &-section {
padding: .5rem 0 1rem; padding: .5rem 0 1rem;
@include respond-to(handhelds) {
padding-bottom: .5rem;
}
&-content { &-content {
//margin: 0 .125rem; margin: 0 .5rem;
//@include respond-to(not-handhelds) { @include respond-to(handhelds) {
margin: 0 .5rem; margin: 0 .25rem;
//} }
> .btn-primary { > .btn-primary {
margin: 0; margin: 0;
@ -848,7 +852,7 @@
&-caption { &-caption {
margin-top: 1rem; margin-top: 1rem;
font-size: .875rem; font-size: 1rem;
color: #707579; color: #707579;
line-height: 1.3125; line-height: 1.3125;
padding: 0 1rem; padding: 0 1rem;
@ -911,8 +915,6 @@
max-width: 342px; max-width: 342px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
font-size: 1rem;
line-height: 1.3125;
margin-bottom: 1.125rem; margin-bottom: 1.125rem;
} }
} }
@ -992,14 +994,11 @@
} }
.privacy-tab { .privacy-tab {
.sidebar-left-section-caption { // * Last Seen & Online verified with mockup
font-size: 1rem;
line-height: 1.3125;
}
// * just to match mockup // * just to match mockup
.sidebar-left-section:first-child { @include respond-to(not-handhelds) {
padding-bottom: 1.125rem; .sidebar-left-section:first-child {
padding-bottom: 1.125rem;
}
} }
form { form {
@ -1040,10 +1039,6 @@
} }
.blocked-users-container { .blocked-users-container {
.sidebar-left-section-caption {
font-size: 1rem;
}
li > .rp { li > .rp {
height: 66px; height: 66px;
max-height: 66px; max-height: 66px;

Loading…
Cancel
Save