From 9259d189a957e44d2caa344cfcfaa99a552c90ac Mon Sep 17 00:00:00 2001 From: mpuebla Date: Mon, 30 Dec 2019 10:25:46 -0300 Subject: [PATCH] Agregado scroll horizontal en la seccion de articulos en el carrito --- .../seleccion-productos.component.html | 26 ++++++++++----------- .../seleccion-productos.component.ts | 27 +++++++++++++--------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/app/modules/seleccion-productos/seleccion-productos.component.html b/src/app/modules/seleccion-productos/seleccion-productos.component.html index 69026d1..228977b 100644 --- a/src/app/modules/seleccion-productos/seleccion-productos.component.html +++ b/src/app/modules/seleccion-productos/seleccion-productos.component.html @@ -29,7 +29,7 @@ (contextmenu)="false" class="h-100 d-block mx-auto rotate-90-neg" src="assets/img/ir-color.svg" - (mousedown)="scroll(templateCategorias, -80)" + (mousedown)="scrollY(templateCategorias, -80)" (mouseup)="mouseup()" (mouseleave)="mouseup()"> @@ -55,7 +55,7 @@ (contextmenu)="false" class="h-100 d-block mx-auto rotate-90" src="assets/img/ir-color.svg" - (mousedown)="scroll(templateCategorias, 80)" + (mousedown)="scrollY(templateCategorias, 80)" (mouseup)="mouseup()" (mouseleave)="mouseup()"> @@ -92,9 +92,9 @@
-

PRODUCTOS EN TÚ CARRITO DE COMPRAS

+

PRODUCTOS EN TÚ CARRITO DE COMPRAS

-
+
-
-
+
+
+ *ngFor="let categoria of [{},{},{},{},{},{},{},{},{},{},{},{},{},{}]; let i = index;"> -

{{'lala'}}

+

{{'lala'}}

@@ -126,7 +126,7 @@ (contextmenu)="false" class="img-ir" src="assets/img/ir-fondo-color.svg" - (mousedown)="scroll(templateCarrito, -80)" + (mousedown)="scrollX(templateCarrito, 100)" (mouseup)="mouseup()" (mouseleave)="mouseup()">
@@ -135,4 +135,4 @@
-
\ No newline at end of file +
diff --git a/src/app/modules/seleccion-productos/seleccion-productos.component.ts b/src/app/modules/seleccion-productos/seleccion-productos.component.ts index 27703f4..5cb27d7 100644 --- a/src/app/modules/seleccion-productos/seleccion-productos.component.ts +++ b/src/app/modules/seleccion-productos/seleccion-productos.component.ts @@ -1,22 +1,21 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; @Component({ - selector: 'app-seleccion-productos', - templateUrl: './seleccion-productos.component.html', - styleUrls: ['./seleccion-productos.component.scss'] + selector: "app-seleccion-productos", + templateUrl: "./seleccion-productos.component.html", + styleUrls: ["./seleccion-productos.component.scss"] }) export class SeleccionProductosComponent implements OnInit { timeoutHandler: any; categorias = [ { id: 1, selected: false }, { id: 2, selected: false }, - { id: 3, selected: false }, + { id: 3, selected: false } ]; - constructor() { } + constructor() {} - ngOnInit() { - } + ngOnInit() {} selectCategoria(index: number) { this.categorias.forEach((categoria, i) => { @@ -29,11 +28,17 @@ export class SeleccionProductosComponent implements OnInit { clearInterval(this.timeoutHandler); } - scroll(el: HTMLElement, value) { - el.scroll({ behavior: 'smooth', top: (value + el.scrollTop) }); + scrollY(el: HTMLElement, value) { + el.scroll({ behavior: "smooth", top: value + el.scrollTop }); this.timeoutHandler = setInterval(() => { - el.scroll({ behavior: 'smooth', top: (value + el.scrollTop) }); + el.scroll({ behavior: "smooth", top: value + el.scrollTop }); }, 500); } + scrollX(el: HTMLElement, value) { + el.scroll({ behavior: "smooth", left: value + el.scrollLeft }); + this.timeoutHandler = setInterval(() => { + el.scroll({ behavior: "smooth", left: value + el.scrollLeft }); + }, 500); + } } -- 1.9.1