From 3aee4ecdf7df71c25af96057e21586b49b1ea23f Mon Sep 17 00:00:00 2001 From: Artur Stepaniuk Date: Mon, 21 May 2018 13:37:03 +0300 Subject: [PATCH] added rotation option --- src/VuePictureSwipe.vue | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/VuePictureSwipe.vue b/src/VuePictureSwipe.vue index 3248d16..38f4d81 100644 --- a/src/VuePictureSwipe.vue +++ b/src/VuePictureSwipe.vue @@ -27,6 +27,12 @@
+ + + rotate_left + rotate_right + + @@ -41,9 +47,9 @@ - -
@@ -85,7 +91,9 @@ } }, data() { - return {}; + return { + angle: 0 + }; }, mounted() { let that = this; @@ -292,12 +300,31 @@ initPhotoSwipeFromDOM('.my-gallery'); + }, + methods: { + rotate: function(newAngle) { + this.angle = this.angle + newAngle + this.$el.querySelectorAll('.pswp__img').forEach(i => i.style.transform = `rotate(${this.angle}deg)`) + }, + resetAngle: function() { + this.angle = 0 + this.$el.querySelectorAll('.pswp__img').forEach(i => i.style.transform = `rotate(${this.angle}deg)`) + }, } } \ No newline at end of file +