js-cloudimage-360-view 2.7.0 → 2.7.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -25,20 +25,30 @@ Types of changes:
25
25
  - ...
26
26
 
27
27
  -------------
28
+ ## 2.7.1 - 2020-11-06
29
+ ### Added
30
+ - click to reset mouse zoom
31
+ - show 360 logo after play once
32
+ ### Fixed
33
+ - set click as default value to start zoom
34
+ - Sass error
35
+ ### Changed
36
+ - pointer zoom behavior
28
37
 
29
38
  ## 2.7.0 - 2020-11-04
30
39
  ### Added
31
- - play once then stops auto-play
32
- - spin in y-direction
40
+ - play once then stop auto-play
41
+ - spin in the y-direction
33
42
  - zoom with mouse wheel
34
43
  - zoom with fingers on mobile
35
- - possibilty to change icons styles
44
+ - possibility to change icons styles
36
45
 
37
46
  ### Fixed
38
47
  - hide scrollbar in fullscreen mode
39
48
  - auto-play not working on mobile
40
49
  - error on init the plugin inside a modal
41
- - removed chrome waringing about non-passive events
50
+ - removed chrome warning about non-passive events
51
+ - images are not resized when window size changes
42
52
 
43
53
  ### Changed
44
54
  - migrate CDN URL to V7
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Release](https://img.shields.io/badge/release-v2.7.0-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases)
1
+ [![Release](https://img.shields.io/badge/release-v2.7.1-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases)
2
2
  [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)](#contributing)
3
3
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
4
  [![Scaleflex team](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg)](https://www.scaleflex.it/en/home)
@@ -9,7 +9,7 @@
9
9
  <img
10
10
  height="175"
11
11
  alt="The Lounge"
12
- src="https://demo.cloudimg.io/v7/https://scaleflex.airstore.io/filerobot/filerobot-cloudimage.png?sanitize=true">
12
+ src="https://assets.scaleflex.com/Marketing/Logos/Cloudimage+Logos/Logotype+with+Scaleflex/LOGO+WITH+SCALEFLEX-01.png?vh=f6080d&force_format=jpg">
13
13
  </p>
14
14
 
15
15
  <h1 align="center">
@@ -69,7 +69,7 @@ To see the Cloudimage 360 view plugin in action, please check out the
69
69
  Add script tag with CDN link to js-cloudimage-360-view lib after all content in body tag
70
70
 
71
71
  ```javascript
72
- <script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/2.7.0/js-cloudimage-360-view.min.js"></script>
72
+ <script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/2.7.1/js-cloudimage-360-view.min.js"></script>
73
73
  ```
74
74
 
75
75
  ## <a name="initialize"></a>Step 2: Initialize
@@ -161,7 +161,20 @@ The selector for js-cloudimage-360-view lib.
161
161
  ###### Type: **String(url)** | _required_
162
162
 
163
163
  Your images folder on server.
164
+ ### data-api-version (or api-version)
164
165
 
166
+ ###### Type: **String** |Default: **'v7'** | _optional_
167
+
168
+ Allow to use a specific version of API.
169
+
170
+ - set a specific version of API
171
+ ```javascript
172
+ data-api-version="v7"
173
+ ```
174
+ - disable API version
175
+ ```javascript
176
+ data-api-version="null"
177
+ ```
165
178
  ### data-filename (or filename)
166
179
 
167
180
  ###### Type: **String** | Default: **image-{index}.jpg** | _optional_
@@ -198,6 +211,12 @@ Support for 360 spin by pressing arrow keys on keyboard.
198
211
 
199
212
  Autoplay 360 spin view on load.
200
213
 
214
+ ### data-play-once (or autoplay)
215
+
216
+ ###### Type: **Bool** | Default: **false** | _optional_
217
+
218
+ stops the autoplay after one complete cycle.
219
+
201
220
  ### data-autoplay-behavior (or autoplay-behavior)
202
221
 
203
222
  ###### Type: **String** | Default: **spin-x** | _optional_
@@ -236,6 +255,12 @@ Prevents page from jumping.
236
255
 
237
256
  Autoplay 360 spin view on load.
238
257
 
258
+ ### data-disable-drag (or disable-drag)
259
+
260
+ ###### Type: **bool** | Default: **false** | _optional_
261
+
262
+ disable mouse drag.
263
+
239
264
  ### data-speed (or speed)
240
265
 
241
266
  ###### Type: **Number** | Default: **150** | _optional_
@@ -338,7 +363,7 @@ Disable pointer zoom on desktop
338
363
  Disable pinch zoom on mobile
339
364
  ### data-to-start-pointer-zoom (or to-start-pointer-zoom)
340
365
 
341
- ###### Type: **string** | Default: **scroll** | _optional_
366
+ ###### Type: **string** | Default: **click** | _optional_
342
367
 
343
368
  Events to start pointer zoom
344
369
 
@@ -28,9 +28,12 @@ var AUTOPLAY_BEHAVIOR = {
28
28
  var ORGINAL_SIZE_REGEX = /width=\d+|w=\d+|h=\d+|&width=\d+|&w=\d+|&h=\d+|func=\w+|\?$/g;
29
29
  var AND_SYMBOL_REGEX = /\?&/g;
30
30
 
31
+ var falsyValues = [false, 0, null, undefined, 'false', "0", 'null', 'undefined'];
32
+
31
33
  exports.TO_START_POINTER_ZOOM = TO_START_POINTER_ZOOM;
32
34
  exports.MOUSE_LEAVE_ACTIONS = MOUSE_LEAVE_ACTIONS;
33
35
  exports.ORIENTATIONS = ORIENTATIONS;
34
36
  exports.AUTOPLAY_BEHAVIOR = AUTOPLAY_BEHAVIOR;
35
37
  exports.ORGINAL_SIZE_REGEX = ORGINAL_SIZE_REGEX;
36
- exports.AND_SYMBOL_REGEX = AND_SYMBOL_REGEX;
38
+ exports.AND_SYMBOL_REGEX = AND_SYMBOL_REGEX;
39
+ exports.falsyValues = falsyValues;
@@ -45,6 +45,7 @@ var CI360Viewer = function () {
45
45
  this.init(container);
46
46
  this.clickedToZoom = false;
47
47
  this.isMagnifyOpen = false;
48
+ this.isDragged = false;
48
49
  this.startPointerZoom = false;
49
50
  this.zoomIntensity = 0;
50
51
  this.mouseTracked = false;
@@ -75,18 +76,21 @@ var CI360Viewer = function () {
75
76
  this.intialPositions = { x: pageX, y: pageY };
76
77
  this.movementStart = { x: pageX, y: pageY };
77
78
  this.isClicked = true;
78
- this.clickedToZoom = true;
79
- this.container.style.cursor = 'grabbing';
79
+ this.isDragged = false;
80
80
  }
81
81
  }, {
82
82
  key: 'mouseUp',
83
83
  value: function mouseUp() {
84
84
  if (!this.imagesLoaded || !this.isClicked) return;
85
-
86
85
  this.movementStart = { x: 0, y: 0 };
87
86
  this.isStartSpin = false;
88
87
  this.isClicked = false;
89
- this.container.style.cursor = 'grab';
88
+
89
+ if (!this.clickedToZoom) {
90
+ this.container.style.cursor = 'grab';
91
+ } else {
92
+ this.container.style.cursor = 'nesw-resize';
93
+ }
90
94
 
91
95
  if (this.bottomCircle && !this.zoomIntensity) {
92
96
  this.show360ViewCircleIcon();
@@ -108,8 +112,12 @@ var CI360Viewer = function () {
108
112
  if (this.isClicked) {
109
113
  var nextPositions = { x: pageX, y: pageY };
110
114
 
115
+ this.container.style.cursor = 'grabbing';
116
+
111
117
  this.updateMovingDirection(this.intialPositions, nextPositions);
112
118
  this.onMoveHandler(event);
119
+
120
+ this.isDragged = true;
113
121
  } else if (this.zoomIntensity) {
114
122
  this.update();
115
123
  }
@@ -127,6 +135,16 @@ var CI360Viewer = function () {
127
135
 
128
136
  if (differenceInPositionY > sensitivity && this.allowSpinY) this.movingDirection = _ci2.ORIENTATIONS.Y;
129
137
  }
138
+ }, {
139
+ key: 'mouseClick',
140
+ value: function mouseClick(event) {
141
+ if (!this.isDragged && this.clickedToZoom) {
142
+ this.resetZoom();
143
+ } else if (!this.isDragged) {
144
+ this.clickedToZoom = true;
145
+ this.container.style.cursor = 'nesw-resize';
146
+ }
147
+ }
130
148
  }, {
131
149
  key: 'mouseScroll',
132
150
  value: function mouseScroll(event) {
@@ -136,9 +154,18 @@ var CI360Viewer = function () {
136
154
  var isScrolledToZoom = this.toStartPointerZoom === _ci2.TO_START_POINTER_ZOOM.SCROLL_TO_START;
137
155
 
138
156
  if (isClickedToZoom || isScrolledToZoom) {
157
+ this.container.style.cursor = 'nesw-resize';
158
+
139
159
  this.initMouseScrollZoom(event);
140
160
  }
141
161
  }
162
+ }, {
163
+ key: 'closeZoomHandler',
164
+ value: function closeZoomHandler() {
165
+ this.container.style.cursor = 'grab';
166
+ this.clickedToZoom = false;
167
+ this.resetZoom();
168
+ }
142
169
  }, {
143
170
  key: 'touchStart',
144
171
  value: function touchStart(event) {
@@ -190,12 +217,19 @@ var CI360Viewer = function () {
190
217
  }
191
218
  }, {
192
219
  key: 'keyDownGeneral',
193
- value: function keyDownGeneral() {
220
+ value: function keyDownGeneral(event) {
194
221
  if (!this.imagesLoaded) return;
195
222
 
196
223
  if (this.glass) {
197
224
  this.closeMagnifier();
198
225
  }
226
+
227
+ if (event.keyCode === 27) {
228
+ //ESC
229
+ if (this.clickedToZoom) {
230
+ this.closeZoomHandler();
231
+ }
232
+ }
199
233
  }
200
234
  }, {
201
235
  key: 'hideInitialIcons',
@@ -346,6 +380,8 @@ var CI360Viewer = function () {
346
380
  this.mouseTracked = false;
347
381
  this.clickedToZoom = false;
348
382
 
383
+ this.container.style.cursor = 'grab';
384
+
349
385
  if (this.resetZoomIcon) this.hideResetZoomIcon();
350
386
 
351
387
  if (this.zoomIntensity) {
@@ -655,6 +691,63 @@ var CI360Viewer = function () {
655
691
  this.moveActiveYIndexDown(1);
656
692
  this.update();
657
693
  }
694
+ }, {
695
+ key: 'getContainerResponsiveWidth',
696
+ value: function getContainerResponsiveWidth() {
697
+ var parentEl = this.container.parentNode || {};
698
+
699
+ if (this.containerWidth) {
700
+ if (parentEl.offsetWidth < this.containerWidth) {
701
+ return parentEl.offsetWidth;
702
+ }
703
+
704
+ return this.containerWidth;
705
+ }
706
+
707
+ return parentEl.offsetWidth;
708
+ }
709
+ }, {
710
+ key: 'getContainerResponsiveHeight',
711
+ value: function getContainerResponsiveHeight(width) {
712
+ if (this.containerHeight) {
713
+ if (width < this.containerHeight) {
714
+ return width;
715
+ }
716
+
717
+ return this.containerHeight;
718
+ }
719
+
720
+ return this.container.offsetWidth;
721
+ }
722
+ }, {
723
+ key: 'updateContainerSize',
724
+ value: function updateContainerSize(image) {
725
+ var imageAspectRatio = image.width / image.height;
726
+ var isProvidedHeightLessThanWidth = this.containerHeight < this.containerWidth;
727
+ var containerWidth = this.getContainerResponsiveWidth();
728
+ var containerHeight = this.getContainerResponsiveHeight(containerWidth);
729
+
730
+ if (this.containerWidth && this.containerHeight) {
731
+ this.container.style.width = containerWidth + 'px';
732
+ this.container.style.height = containerHeight / imageAspectRatio + 'px';
733
+
734
+ return;
735
+ }
736
+
737
+ if (!this.containerWidth && !this.containerHeight) {
738
+ this.container.style.height = containerHeight / imageAspectRatio + 'px';
739
+
740
+ return;
741
+ }
742
+
743
+ if ((isProvidedHeightLessThanWidth || !this.containerWidth) && this.containerHeight) {
744
+ this.container.style.maxWidth = containerHeight * imageAspectRatio + 'px';
745
+ this.container.style.height = containerHeight + 'px';
746
+ } else {
747
+ this.container.style.maxWidth = containerWidth + 'px';
748
+ this.container.style.height = containerWidth / imageAspectRatio + 'px';
749
+ }
750
+ }
658
751
  }, {
659
752
  key: 'onLoadResizedImages',
660
753
  value: function onLoadResizedImages(orientation, event) {
@@ -663,6 +756,10 @@ var CI360Viewer = function () {
663
756
  var totalAmount = this.amountX + this.amountY;
664
757
  var totalLoadedImages = this.loadedImagesX + this.loadedImagesY;
665
758
 
759
+ if (this.loadedImagesX === 1 && orientation !== _ci2.ORIENTATIONS.Y) {
760
+ this.updateContainerSize(event.target);
761
+ }
762
+
666
763
  if (totalLoadedImages === totalAmount) {
667
764
  this.replaceImages(orientation);
668
765
  this.update();
@@ -729,12 +826,12 @@ var CI360Viewer = function () {
729
826
  }, {
730
827
  key: 'requestResizedImages',
731
828
  value: function requestResizedImages() {
732
- var srcX = this.getSrc(this.responsive, this.container, this.folder, this.filenameX, this.ciParams);
829
+ var srcX = this.getSrc(this.container, this.folder, this.apiVersion, this.filenameX, this.ciParams);
733
830
 
734
831
  this.requestNewImages(srcX, this.amountX, _ci2.ORIENTATIONS.X);
735
832
 
736
833
  if (this.allowSpinY) {
737
- var srcY = this.getSrc(this.responsive, this.container, this.folder, this.filenameY, this.ciParams);
834
+ var srcY = this.getSrc(this.container, this.folder, this.apiVersion, this.filenameY, this.ciParams);
738
835
 
739
836
  this.requestNewImages(srcY, this.amountY, _ci2.ORIENTATIONS.Y);
740
837
  }
@@ -768,8 +865,9 @@ var CI360Viewer = function () {
768
865
  } else {
769
866
  this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
770
867
  this.canvas.style.width = this.container.offsetWidth + 'px';
771
- this.canvas.height = this.container.offsetWidth * this.devicePixelRatio / image.width * image.height;
772
- this.canvas.style.height = this.container.offsetWidth / image.width * image.height + 'px';
868
+
869
+ this.canvas.height = this.container.offsetHeight * this.devicePixelRatio;
870
+ this.canvas.style.height = this.container.offsetHeight + 'px';
773
871
 
774
872
  if (this.startPointerZoom || this.startPinchZoom) {
775
873
  this.updateImageScale(ctx);
@@ -856,6 +954,8 @@ var CI360Viewer = function () {
856
954
  value: function onFirstImageLoaded(event) {
857
955
  var _this2 = this;
858
956
 
957
+ this.updateContainerSize(event.target);
958
+
859
959
  if (!this.hide360Logo) {
860
960
  this.add360ViewIcon();
861
961
  }
@@ -886,7 +986,7 @@ var CI360Viewer = function () {
886
986
  }
887
987
 
888
988
  if (this.container.offsetWidth === 0) {
889
- var modalRef = this.container.parentElement;
989
+ var modalRef = this.container.parentNode || {};
890
990
 
891
991
  this.canvas.width = parseInt(modalRef.style.width) * this.devicePixelRatio;
892
992
  this.canvas.style.width = modalRef.style.width;
@@ -899,8 +999,8 @@ var CI360Viewer = function () {
899
999
  this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
900
1000
  this.canvas.style.width = this.container.offsetWidth + 'px';
901
1001
 
902
- this.canvas.height = this.container.offsetWidth * this.devicePixelRatio / event.target.width * event.target.height;
903
- this.canvas.style.height = this.container.offsetWidth / event.target.width * event.target.height + 'px';
1002
+ this.canvas.height = this.container.offsetHeight * this.devicePixelRatio;
1003
+ this.canvas.style.height = this.container.offsetHeight + 'px';
904
1004
  }
905
1005
 
906
1006
  _ctx.drawImage(imagePreview, 0, 0, this.canvas.width, this.canvas.height);
@@ -921,10 +1021,6 @@ var CI360Viewer = function () {
921
1021
  });
922
1022
  }
923
1023
 
924
- if (this.ratio) {
925
- this.container.style.minHeight = 'auto';
926
- }
927
-
928
1024
  if (this.fullscreenView) {
929
1025
  this.addCloseFullscreenView();
930
1026
  }
@@ -1017,7 +1113,7 @@ var CI360Viewer = function () {
1017
1113
  value: function hideFullscreenIcon() {
1018
1114
  if (!this.fullscreenIcon) return;
1019
1115
 
1020
- this.fullscreenIcon.style.opacity = '0.4';
1116
+ this.fullscreenIcon.style.display = 'none';
1021
1117
  this.fullscreenIcon.style.pointerEvents = 'none';
1022
1118
  }
1023
1119
  }, {
@@ -1025,7 +1121,7 @@ var CI360Viewer = function () {
1025
1121
  value: function showFullscreenIcon() {
1026
1122
  if (!this.fullscreenIcon) return;
1027
1123
 
1028
- this.fullscreenIcon.style.opacity = '1';
1124
+ this.fullscreenIcon.style.display = 'block';
1029
1125
  this.fullscreenIcon.style.pointerEvents = 'auto';
1030
1126
  }
1031
1127
  }, {
@@ -1045,7 +1141,7 @@ var CI360Viewer = function () {
1045
1141
  value: function disableMagnifierIcon() {
1046
1142
  if (!this.magnifierIcon) return;
1047
1143
 
1048
- this.magnifierIcon.style.opacity = '0.4';
1144
+ this.magnifierIcon.style.display = 'none';
1049
1145
  this.magnifierIcon.style.pointerEvents = 'none';
1050
1146
  }
1051
1147
  }, {
@@ -1053,7 +1149,7 @@ var CI360Viewer = function () {
1053
1149
  value: function enableMagnifierIcon() {
1054
1150
  if (!this.magnifierIcon) return;
1055
1151
 
1056
- this.magnifierIcon.style.opacity = '1';
1152
+ this.magnifierIcon.style.display = 'block';
1057
1153
  this.magnifierIcon.style.pointerEvents = 'auto';
1058
1154
  }
1059
1155
  }, {
@@ -1280,6 +1376,11 @@ var CI360Viewer = function () {
1280
1376
 
1281
1377
  if (_this4.playOnce && isPlayedOnce) {
1282
1378
  window.clearTimeout(_this4.loopTimeoutId);
1379
+
1380
+ _this4.add360ViewIcon();
1381
+
1382
+ _this4.view360Icon.innerText = '';
1383
+ (0, _ci.setView360Icon)(_this4.view360Icon, _this4.logoSrc);
1283
1384
  }
1284
1385
  }, this.autoplaySpeed);
1285
1386
  }
@@ -1291,16 +1392,20 @@ var CI360Viewer = function () {
1291
1392
  }
1292
1393
  }, {
1293
1394
  key: 'getSrc',
1294
- value: function getSrc(responsive, container, folder, filename, _ref) {
1295
- var ciToken = _ref.ciToken,
1296
- ciFilters = _ref.ciFilters,
1297
- ciTransformation = _ref.ciTransformation;
1395
+ value: function getSrc(container, folder, apiVersion, filename) {
1396
+ var ciParams = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1397
+ var ciToken = ciParams.ciToken,
1398
+ ciFilters = ciParams.ciFilters,
1399
+ ciTransformation = ciParams.ciTransformation;
1298
1400
 
1299
1401
  var src = '' + folder + filename;
1300
1402
 
1301
- if (responsive) {
1403
+ if (ciToken) {
1302
1404
  var imageOffsetWidth = container.offsetWidth;
1303
1405
 
1406
+ var vesrion = _ci2.falsyValues.indexOf(apiVersion) !== -1 ? null : apiVersion;
1407
+ var finalApiVersion = vesrion ? vesrion + '/' : '';
1408
+
1304
1409
  if (this.fullscreenView) {
1305
1410
  var containerRatio = container.offsetHeight / container.offsetWidth;
1306
1411
 
@@ -1311,7 +1416,7 @@ var CI360Viewer = function () {
1311
1416
 
1312
1417
  var ciSizeNext = (0, _ci.getSizeAccordingToPixelRatio)((0, _ci.getResponsiveWidthOfContainer)(imageOffsetWidth));
1313
1418
 
1314
- src = 'https://' + ciToken + '.cloudimg.io/v7/' + src + '?' + (ciTransformation ? ciTransformation : 'width=' + ciSizeNext) + (ciFilters ? '&f=' + ciFilters : '');
1419
+ src = 'https://' + ciToken + '.cloudimg.io/' + finalApiVersion + src + '?' + (ciTransformation ? ciTransformation : 'width=' + ciSizeNext) + (ciFilters ? '&f=' + ciFilters : '');
1315
1420
  }
1316
1421
 
1317
1422
  return src;
@@ -1323,11 +1428,12 @@ var CI360Viewer = function () {
1323
1428
  var lazyload = arguments[3];
1324
1429
  var lazySelector = arguments[4];
1325
1430
  var container = arguments[5];
1431
+ var ciParams = arguments[6];
1326
1432
 
1327
1433
  var _this5 = this;
1328
1434
 
1329
- var responsive = arguments[6];
1330
- var ciParams = arguments[7];
1435
+ var apiVersion = arguments[7];
1436
+ var filename = arguments[8];
1331
1437
 
1332
1438
  if (this.imageList) {
1333
1439
  try {
@@ -1336,7 +1442,7 @@ var CI360Viewer = function () {
1336
1442
  this.amountX = images.length;
1337
1443
  images.forEach(function (src, index) {
1338
1444
  var folder = /(http(s?)):\/\//gi.test(src) ? '' : _this5.folder;
1339
- var resultSrc = _this5.getSrc(responsive, container, folder, src, ciParams);
1445
+ var resultSrc = _this5.getSrc(container, folder, apiVersion, filename, ciParams);
1340
1446
  var lastIndex = resultSrc.lastIndexOf('//');
1341
1447
  var originalSrc = resultSrc.slice(lastIndex);
1342
1448
 
@@ -1536,11 +1642,6 @@ var CI360Viewer = function () {
1536
1642
  this.canvas.style.width = '100%';
1537
1643
  this.canvas.style.fontSize = '0';
1538
1644
 
1539
- if (this.ratio) {
1540
- this.container.style.minHeight = this.container.offsetWidth * this.ratio + 'px';
1541
- this.canvas.height = parseInt(this.container.style.minHeight);
1542
- }
1543
-
1544
1645
  this.innerBox.appendChild(this.canvas);
1545
1646
  }
1546
1647
  }, {
@@ -1550,7 +1651,7 @@ var CI360Viewer = function () {
1550
1651
 
1551
1652
  window.addEventListener('resize', (0, _ci.debounce)(function () {
1552
1653
  _this7.requestResizedImages();
1553
- }, 300));
1654
+ }, 80));
1554
1655
 
1555
1656
  if (draggable && !this.disableDrag) {
1556
1657
  this.container.addEventListener('mousedown', this.mouseDown.bind(this));
@@ -1565,6 +1666,7 @@ var CI360Viewer = function () {
1565
1666
  }
1566
1667
 
1567
1668
  if (!this.disablePointerZoom && !this.fullscreenView) {
1669
+ this.container.addEventListener('click', this.mouseClick.bind(this));
1568
1670
  this.container.addEventListener('wheel', this.mouseScroll.bind(this));
1569
1671
  }
1570
1672
 
@@ -1609,6 +1711,7 @@ var CI360Viewer = function () {
1609
1711
  value: function init(container) {
1610
1712
  var _get360ViewProps = (0, _ci.get360ViewProps)(container),
1611
1713
  folder = _get360ViewProps.folder,
1714
+ apiVersion = _get360ViewProps.apiVersion,
1612
1715
  filenameX = _get360ViewProps.filenameX,
1613
1716
  filenameY = _get360ViewProps.filenameY,
1614
1717
  imageList = _get360ViewProps.imageList,
@@ -1644,7 +1747,6 @@ var CI360Viewer = function () {
1644
1747
  magnifier = _get360ViewProps.magnifier,
1645
1748
  magnifyInFullscreen = _get360ViewProps.magnifyInFullscreen,
1646
1749
  ratio = _get360ViewProps.ratio,
1647
- responsive = _get360ViewProps.responsive,
1648
1750
  ciToken = _get360ViewProps.ciToken,
1649
1751
  ciFilters = _get360ViewProps.ciFilters,
1650
1752
  ciTransformation = _get360ViewProps.ciTransformation,
@@ -1655,7 +1757,9 @@ var CI360Viewer = function () {
1655
1757
  stopAtEdges = _get360ViewProps.stopAtEdges,
1656
1758
  controlReverse = _get360ViewProps.controlReverse,
1657
1759
  hide360Logo = _get360ViewProps.hide360Logo,
1658
- logoSrc = _get360ViewProps.logoSrc;
1760
+ logoSrc = _get360ViewProps.logoSrc,
1761
+ containerWidth = _get360ViewProps.containerWidth,
1762
+ containerHeight = _get360ViewProps.containerHeight;
1659
1763
 
1660
1764
  var ciParams = { ciToken: ciToken, ciFilters: ciFilters, ciTransformation: ciTransformation };
1661
1765
 
@@ -1664,6 +1768,7 @@ var CI360Viewer = function () {
1664
1768
  this.addLoader();
1665
1769
 
1666
1770
  this.folder = folder;
1771
+ this.apiVersion = apiVersion;
1667
1772
  this.filenameX = filenameX;
1668
1773
  this.filenameY = filenameY;
1669
1774
  this.imageList = imageList;
@@ -1702,20 +1807,22 @@ var CI360Viewer = function () {
1702
1807
  this.stopAtEdges = stopAtEdges;
1703
1808
  this.hide360Logo = hide360Logo;
1704
1809
  this.logoSrc = logoSrc;
1705
- this.responsive = responsive;
1706
1810
  this.ciParams = ciParams;
1811
+ this.apiVersion = apiVersion;
1812
+ this.containerWidth = containerWidth;
1813
+ this.containerHeight = containerHeight;
1707
1814
 
1708
1815
  this.applyStylesToContainer();
1709
1816
 
1710
1817
  this.addCanvas();
1711
1818
 
1712
- var srcX = this.getSrc(responsive, container, folder, filenameX, ciParams);
1713
- var srcY = this.getSrc(responsive, container, folder, filenameY, ciParams);
1819
+ var srcX = this.getSrc(container, folder, apiVersion, filenameX, ciParams);
1820
+ var srcY = this.getSrc(container, folder, apiVersion, filenameY, ciParams);
1714
1821
 
1715
- this.preloadImages(amountX, srcX, _ci2.ORIENTATIONS.X, lazyload, lazySelector, container, responsive, ciParams);
1822
+ this.preloadImages(amountX, srcX, _ci2.ORIENTATIONS.X, lazyload, lazySelector, container, ciParams, apiVersion, filenameX);
1716
1823
 
1717
1824
  if (amountY) {
1718
- this.preloadImages(amountY, srcY, _ci2.ORIENTATIONS.Y, lazyload, lazySelector, container, responsive, ciParams);
1825
+ this.preloadImages(amountY, srcY, _ci2.ORIENTATIONS.Y, lazyload, lazySelector, container, ciParams, apiVersion, filenameY);
1719
1826
  }
1720
1827
 
1721
1828
  this.attachEvents(draggable, swipeable, keys);
@@ -11,6 +11,7 @@ var _ci = require('./ci360.constants');
11
11
  var get360ViewProps = function get360ViewProps(image) {
12
12
  return {
13
13
  folder: attr(image, 'folder') || attr(image, 'data-folder') || '/',
14
+ apiVersion: attr(image, 'api-version') || attr(image, 'data-api-version') || attr(image, 'apiVersion') || attr(image, 'data-apiVersion') || "v7",
14
15
  filenameX: attr(image, 'filename') || attr(image, 'data-filename') || attr(image, 'filename-x') || attr(image, 'data-filename-x') || 'image-{index}.jpg',
15
16
  filenameY: attr(image, 'filename-y') || attr(image, 'data-filename-y') || 'image-y-{index}.jpg',
16
17
  imageList: attr(image, 'image-list') || attr(image, 'data-image-list') || null,
@@ -28,7 +29,7 @@ var get360ViewProps = function get360ViewProps(image) {
28
29
  disablePointerZoom: isTrue(image, 'disable-pointer-zoom'),
29
30
  disablePinchZoom: isTrue(image, 'disable-pinch-zoom'),
30
31
  onMouseLeave: attr(image, 'on-mouse-leave') || attr(image, 'data-on-mouse-leave'),
31
- toStartPointerZoom: attr(image, 'to-start-pointer-zoom') || attr(image, 'data-to-start-pointer-zoom') || _ci.TO_START_POINTER_ZOOM.SCROLL_TO_START,
32
+ toStartPointerZoom: attr(image, 'to-start-pointer-zoom') || attr(image, 'data-to-start-pointer-zoom') || _ci.TO_START_POINTER_ZOOM.CLICK_TO_START,
32
33
  pointerZoomFactor: parseInt(attr(image, 'pointer-zoom-factor') || attr(image, 'data-pointer-zoom-factor') || 2, 10),
33
34
  pinchZoomFactor: parseInt(attr(image, 'pinch-zoom-factor') || attr(image, 'data-pinch-zoom-factor') || 2, 10),
34
35
  maxScale: parseFloat(attr(image, 'max-scale') || attr(image, 'data-max-scale') || 100, 10),
@@ -40,8 +41,7 @@ var get360ViewProps = function get360ViewProps(image) {
40
41
  magnifyInFullscreen: isTrue(image, 'magnify-in-fullscreen') || isTrue(image, 'magnifier-in-fullscreen'),
41
42
  bottomCircleOffset: parseInt(attr(image, 'bottom-circle-offset') || attr(image, 'data-bottom-circle-offset') || 5, 10),
42
43
  ratio: parseFloat(attr(image, 'ratio') || attr(image, 'data-ratio') || 0) || false,
43
- responsive: isTrue(image, 'responsive'),
44
- ciToken: attr(image, 'responsive') || attr(image, 'data-responsive') || 'demo',
44
+ ciToken: attr(image, 'responsive') || attr(image, 'data-responsive'),
45
45
  ciFilters: attr(image, 'filters') || attr(image, 'data-filters'),
46
46
  ciTransformation: attr(image, 'transformation') || attr(image, 'data-transformation'),
47
47
  lazyload: isTrue(image, 'lazyload'),
@@ -50,7 +50,9 @@ var get360ViewProps = function get360ViewProps(image) {
50
50
  controlReverse: isTrue(image, 'control-reverse'),
51
51
  stopAtEdges: isTrue(image, 'stop-at-edges'),
52
52
  hide360Logo: isTrue(image, 'hide-360-logo'),
53
- logoSrc: attr(image, 'logo-src') || 'https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg'
53
+ logoSrc: attr(image, 'logo-src') || 'https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg',
54
+ containerWidth: parseInt(attr(image, 'width') || attr(image, 'data-width'), 10) || 0,
55
+ containerHeight: parseInt(attr(image, 'height') || attr(image, 'data-height'), 10) || 0
54
56
  };
55
57
  };
56
58
 
@@ -49,7 +49,7 @@
49
49
  right: 0;
50
50
  width: 0%;
51
51
  height: 8px;
52
- background-color: rgb(165,175,184);
52
+ background-color: rgb(165, 175, 184);
53
53
  z-index: 100;
54
54
  }
55
55
 
@@ -71,11 +71,11 @@
71
71
  width: 100px;
72
72
  height: 100px;
73
73
  margin: auto;
74
- background-color: rgba(255,255,255,0.8);
74
+ background-color: rgba(255, 255, 255, 0.8);
75
75
  border-radius: 50%;
76
- box-shadow: rgb(255, 255, 255, 0.5) 0px 0px 4px;
76
+ box-shadow: rgba(255, 255, 255, 0.5) 0px 0px 4px;
77
77
  transition: 0.5s all;
78
- color: rgb(80,80,80);
78
+ color: rgb(80, 80, 80);
79
79
  text-align: center;
80
80
  line-height: 100px;
81
81
  z-index: 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-cloudimage-360-view",
3
- "version": "2.7.0",
3
+ "version": "2.7.2-beta.3",
4
4
  "main": "dist/index.js",
5
5
  "description": "",
6
6
  "author": "scaleflex",
@@ -23,11 +23,11 @@
23
23
  ],
24
24
  "scripts": {
25
25
  "start-demo": "webpack-dev-server --mode development --config config/webpack-demo.config.js",
26
- "clean-build": "del build",
26
+ "clean-build": "rm -rf build",
27
27
  "build": "npm run clean-build && webpack --mode production --config config/webpack-build.config.js",
28
- "clean-dist": "del dist",
28
+ "clean-dist": "rm -rf dist",
29
29
  "dist": "npm run clean-dist && babel src -d dist --copy-files",
30
- "clean-demo": "del examples/dist",
30
+ "clean-demo": "rm -rf examples/dist",
31
31
  "build-demo": "npm run clean-demo && webpack --mode production --config config/webpack-demo.config.js",
32
32
  "deploy-demo": "gh-pages -d examples/dist",
33
33
  "publish-demo": "npm run build-demo && npm run deploy-demo"
@@ -36,6 +36,7 @@
36
36
  "core-js": "^3.0.0"
37
37
  },
38
38
  "devDependencies": {
39
+ "@babel/core": "^7.16.5",
39
40
  "babel-cli": "^6.26.0",
40
41
  "babel-core": "^6.26.3",
41
42
  "babel-loader": "^7.1.4",