js-cloudimage-360-view 2.7.9 → 2.7.10

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,6 +25,11 @@ Types of changes:
25
25
  - ...
26
26
 
27
27
  -------------
28
+ ## 2.8.10 - 2022-03-01
29
+ ### Fixed
30
+ - image quality in fullscreen
31
+ - resized image loading
32
+
28
33
  ## 2.7.9 - 2022-02-27
29
34
  ### Fixed
30
35
  - typo in documentation
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Release](https://img.shields.io/badge/release-v2.7.9-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases)
1
+ [![Release](https://img.shields.io/badge/release-v2.7.10-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)
@@ -106,14 +106,14 @@ window.CI360.init();
106
106
  > <script>window.CI360.init(); // initialize the plugin when you need</script>
107
107
  > ```
108
108
 
109
- ### addView
109
+ ### add
110
110
 
111
111
  ###### Type: **Function**
112
112
 
113
113
  add new view by id to cloudimage 360 views.
114
114
 
115
115
  ```javascript
116
- window.CI360.addView(idOfView: string);
116
+ window.CI360.add(idOfView: string);
117
117
  ```
118
118
 
119
119
  ### update
@@ -241,7 +241,6 @@ data-api-version="v7"
241
241
  ```javascript
242
242
  data-api-version="null"
243
243
  ```
244
- ### data-filename (or filename)
245
244
  ### data-filename-x (or filename-x)
246
245
  ### ~~data-filename (or filename)~~ [deprecated]
247
246
 
@@ -248,10 +248,10 @@ var CI360Viewer = /*#__PURE__*/function () {
248
248
  }
249
249
 
250
250
  var loadedOriginalXImages = this.originalImagesX.filter(function (image) {
251
- return !!image;
251
+ return image;
252
252
  });
253
253
  var loadedOriginalYImages = this.originalImagesY.filter(function (image) {
254
- return !!image;
254
+ return image;
255
255
  });
256
256
  var totalAmount = this.amountX + this.amountY;
257
257
  var totalLoadedImages = loadedOriginalXImages.length + loadedOriginalYImages.length;
@@ -277,7 +277,7 @@ var CI360Viewer = /*#__PURE__*/function () {
277
277
 
278
278
  if (this.allowSpinY) {
279
279
  var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
280
- (0, _utils.preloadOriginalImages)(this.srcXConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
280
+ (0, _utils.preloadOriginalImages)(this.srcYConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
281
281
  }
282
282
  }
283
283
  }, {
@@ -665,6 +665,10 @@ var CI360Viewer = /*#__PURE__*/function () {
665
665
  this.container.height = window.innerHeight * this.devicePixelRatio;
666
666
  this.container.style.height = window.innerHeight + 'px';
667
667
  this.container.style.maxWidth = 'unset';
668
+ this.canvas.width = window.innerWidth * this.devicePixelRatio;
669
+ this.canvas.style.width = window.innerWidth + 'px';
670
+ this.canvas.height = window.innerHeight * this.devicePixelRatio;
671
+ this.canvas.style.height = window.innerHeight + 'px';
668
672
  return;
669
673
  }
670
674
 
@@ -683,10 +687,10 @@ var CI360Viewer = /*#__PURE__*/function () {
683
687
  }
684
688
 
685
689
  var loadedResizedXImages = this.resizedImagesX.filter(function (image) {
686
- return !!image;
690
+ return image;
687
691
  });
688
692
  var loadedResizedYImages = this.resizedImagesY.filter(function (image) {
689
- return !!image;
693
+ return image;
690
694
  });
691
695
  var isAllImagesLoaded = loadedResizedXImages.length + loadedResizedYImages.length === this.amountX + this.amountY;
692
696
 
@@ -717,11 +721,11 @@ var CI360Viewer = /*#__PURE__*/function () {
717
721
  this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
718
722
  var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
719
723
  if (!responsive || this.container.offsetWidth < firstImage.width * 1.5) return;
720
- (0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X), true);
724
+ (0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X));
721
725
 
722
726
  if (this.allowSpinY) {
723
727
  var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
724
- (0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y), true);
728
+ (0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y));
725
729
  }
726
730
  }
727
731
  }, {
@@ -962,9 +966,9 @@ var CI360Viewer = /*#__PURE__*/function () {
962
966
  var viewIndex = viewers.findIndex(function (view) {
963
967
  return view.id === _this5.container.id;
964
968
  });
969
+ container.removeChild(this.innerBox);
965
970
  container = container.cloneNode(true);
966
971
  container.className = container.className.replace(' initialized', '');
967
- container.innerHTML = '';
968
972
  oldElement.parentNode.replaceChild(container, oldElement);
969
973
  return viewers.splice(viewIndex, 1, new CI360Viewer(container));
970
974
  }
@@ -1159,10 +1163,10 @@ var CI360Viewer = /*#__PURE__*/function () {
1159
1163
  onEventEnd: onEventEnd
1160
1164
  };
1161
1165
  var controlsElements = (0, _utils.initControls)(controlsConfig, controlsTriggers);
1162
- this.topElem = controlsElements.top || {};
1163
- this.bottomElem = controlsElements.bottom || {};
1164
- this.leftElem = controlsElements.left || {};
1165
- this.rightElem = controlsElements.right || {};
1166
+ this.topElem = controlsElements.top;
1167
+ this.bottomElem = controlsElements.bottom;
1168
+ this.leftElem = controlsElements.left;
1169
+ this.rightElem = controlsElements.right;
1166
1170
  }
1167
1171
  }, {
1168
1172
  key: "attachEvents",
@@ -1306,10 +1310,6 @@ var CI360Viewer = /*#__PURE__*/function () {
1306
1310
  this.addMagnifier();
1307
1311
  }
1308
1312
 
1309
- if (this.info) {
1310
- this.showImageInfo(ctx);
1311
- }
1312
-
1313
1313
  if (this.bottomCircle && !this.fullscreenView) {
1314
1314
  this.add360ViewCircleIcon();
1315
1315
  }
@@ -1385,11 +1385,11 @@ var CI360Viewer = /*#__PURE__*/function () {
1385
1385
  }
1386
1386
 
1387
1387
  var loadedXImages = _this7.imagesX.filter(function (image) {
1388
- return !!image;
1388
+ return image;
1389
1389
  });
1390
1390
 
1391
1391
  var loadedYImages = _this7.imagesY.filter(function (image) {
1392
- return !!image;
1392
+ return image;
1393
1393
  });
1394
1394
 
1395
1395
  var totalAmount = _this7.amountX + _this7.amountY;
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ function getActiveIndexByID(id, oriantation) {
61
61
  return currentViewer && currentViewer.activeImageX - 1;
62
62
  }
63
63
 
64
- function addView(id) {
64
+ function add(id) {
65
65
  var view360Array = Array.from(document.querySelectorAll('.cloudimage-360:not(.initialized)'));
66
66
 
67
67
  if (view360Array.length && id) {
@@ -77,15 +77,11 @@ function update() {
77
77
  var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
78
78
 
79
79
  if (id) {
80
- try {
81
- var view = window.CI360._viewers.filter(function (viewer) {
82
- return viewer.id === id;
83
- })[0];
84
-
85
- view.updateView(forceUpdate, window.CI360._viewers);
86
- } catch (_unused) {
87
- console.warn("Cloudimage-360: there is no view with such id '".concat(id, "', you may need to run window.addView('").concat(id, "') before run update'"));
88
- }
80
+ var view = window.CI360._viewers.filter(function (viewer) {
81
+ return viewer.id === id;
82
+ })[0];
83
+
84
+ view.updateView(forceUpdate, window.CI360._viewers);
89
85
  } else {
90
86
  window.CI360._viewers.forEach(function (viewer) {
91
87
  viewer.updateView(forceUpdate, window.CI360._viewers);
@@ -102,7 +98,7 @@ window.CI360.init = init;
102
98
  window.CI360.destroy = destroy;
103
99
  window.CI360.getActiveIndexByID = getActiveIndexByID;
104
100
  window.CI360.update = update;
105
- window.CI360.addView = addView;
101
+ window.CI360.add = add;
106
102
 
107
103
  if (!window.CI360.notInitOnLoad) {
108
104
  init();
@@ -118,4 +118,111 @@
118
118
  height: 250px;
119
119
  top: -75px;
120
120
  right: -85px;
121
+ }
122
+
123
+ .cloudimage-360 .cloudimage-360-left,
124
+ .cloudimage-360 .cloudimage-360-right {
125
+ padding: 8px;
126
+ background: rgb(244, 244, 244);
127
+ border: none;
128
+ border-radius: 4px;
129
+ }
130
+
131
+ .cloudimage-360 .cloudimage-360-left:focus,
132
+ .cloudimage-360 .cloudimage-360-right:focus {
133
+ outline: none;
134
+ }
135
+
136
+ .cloudimage-360 .cloudimage-360-left {
137
+ display: none;
138
+ position: absolute;
139
+ z-index: 100;
140
+ top: calc(50% - 15px);
141
+ left: 20px;
142
+ }
143
+
144
+ .cloudimage-360 .cloudimage-360-right {
145
+ display: none;
146
+ position: absolute;
147
+ z-index: 100;
148
+ top: calc(50% - 15px);
149
+ right: 20px;
150
+ }
151
+
152
+ .cloudimage-360 .cloudimage-360-left:before,
153
+ .cloudimage-360 .cloudimage-360-right:before {
154
+ content: '';
155
+ display: block;
156
+ width: 30px;
157
+ height: 30px;
158
+ background: 50% 50% / cover no-repeat;
159
+ }
160
+
161
+ .cloudimage-360 .cloudimage-360-left:before {
162
+ background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-left.svg');
163
+ }
164
+
165
+ .cloudimage-360 .cloudimage-360-right:before {
166
+ background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-right.svg');
167
+ }
168
+
169
+ .cloudimage-360 .cloudimage-360-left.not-active,
170
+ .cloudimage-360 .cloudimage-360-right.not-active {
171
+ opacity: 0.4;
172
+ cursor: default;
173
+ pointer-events: none;
174
+ }
175
+
176
+ .cloudimage-360 .cloudimage-360-top,
177
+ .cloudimage-360 .cloudimage-360-bottom {
178
+ padding: 8px;
179
+ background: rgb(244, 244, 244);
180
+ border: none;
181
+ border-radius: 4px;
182
+ }
183
+
184
+ .cloudimage-360 .cloudimage-360-top:focus,
185
+ .cloudimage-360 .cloudimage-360-bottom:focus {
186
+ outline: none;
187
+ }
188
+
189
+ .cloudimage-360 .cloudimage-360-top {
190
+ display: none;
191
+ position: absolute;
192
+ z-index: 100;
193
+ left: calc(50% - 15px);
194
+ top: 20px;
195
+ transform: rotate(90deg);
196
+ }
197
+
198
+ .cloudimage-360 .cloudimage-360-bottom {
199
+ display: none;
200
+ position: absolute;
201
+ z-index: 100;
202
+ left: calc(50% - 15px);
203
+ bottom: 20px;
204
+ transform: rotate(90deg);
205
+ }
206
+
207
+ .cloudimage-360 .cloudimage-360-top:before,
208
+ .cloudimage-360 .cloudimage-360-bottom:before {
209
+ content: '';
210
+ display: block;
211
+ width: 30px;
212
+ height: 30px;
213
+ background: 50% 50% / cover no-repeat;
214
+ }
215
+
216
+ .cloudimage-360 .cloudimage-360-top:before {
217
+ background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-left.svg');
218
+ }
219
+
220
+ .cloudimage-360 .cloudimage-360-bottom:before {
221
+ background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-right.svg');
222
+ }
223
+
224
+ .cloudimage-360 .cloudimage-360-top.not-active,
225
+ .cloudimage-360 .cloudimage-360-bottom.not-active {
226
+ opacity: 0.4;
227
+ cursor: default;
121
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-cloudimage-360-view",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "main": "dist/index.js",
5
5
  "description": "",
6
6
  "author": "scaleflex",