js-cloudimage-360-view 3.0.1 → 3.0.2
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
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
[](https://github.com/scaleflex/js-cloudimage-360-view/releases)
|
|
2
|
+
[](https://img.shields.io/bundlephobia/min/js-cloudimage-360-view)
|
|
3
|
+
[](https://img.shields.io/npm/dt/js-cloudimage-360-view?logoColor=orange)
|
|
3
4
|
[](#contributing)
|
|
4
5
|
[](https://opensource.org/licenses/MIT)
|
|
5
6
|
[](https://www.scaleflex.com/en/home)
|
|
6
7
|
[](https://www.cloudimage.io/en/home)
|
|
7
8
|
|
|
8
9
|
<p align="center">
|
|
9
|
-
<img
|
|
10
|
+
<img
|
|
10
11
|
alt="cloudimage logo"
|
|
11
12
|
src="https://scaleflex.cloudimg.io/v7/cloudimage.io/LOGO+WITH+SCALEFLEX-01.png?vh=f6080d&w=350">
|
|
12
13
|
</p>
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
•
|
|
22
23
|
<a href="https://scaleflex.github.io/js-cloudimage-360-view/" target="_blank">Demo</a>
|
|
23
24
|
•
|
|
24
|
-
<a href="https://codesandbox.io/s/
|
|
25
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-npne18" target="_blank">Code Sandbox</a>
|
|
25
26
|
•
|
|
26
27
|
<a href="https://youtu.be/zXUgrvZ7FMc" target="_blank">Video Tutorial</a>
|
|
27
28
|
•
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
* [Customize elements](#customize-elements)
|
|
45
46
|
* [Configuration](#configuration)
|
|
46
47
|
* [Controls](#controls)
|
|
48
|
+
* [Spin in X and Y axis](#spin_x_y)
|
|
47
49
|
* [Hotspots](#hotspots)
|
|
48
50
|
* [Cloudimage responsive integration](#cloudimage-responsive-integration)
|
|
49
51
|
* [Lazy loading integration](#lazy-loading)
|
|
@@ -82,7 +84,7 @@ After adding the js-cloudimage-360-view lib, simply initialize it with **class n
|
|
|
82
84
|
></div>
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
<a href="https://codesandbox.io/s/
|
|
87
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-example-l7ce4h"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
86
88
|
|
|
87
89
|
## <a name="methods"></a> Methods
|
|
88
90
|
|
|
@@ -115,6 +117,8 @@ lazy init cloudimage-360 view by id.
|
|
|
115
117
|
#### `idOftheView`: string
|
|
116
118
|
The id of the new view
|
|
117
119
|
|
|
120
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-vxlmoi"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
121
|
+
|
|
118
122
|
### update
|
|
119
123
|
|
|
120
124
|
###### Type: **Function**
|
|
@@ -147,6 +151,8 @@ window.CI360.update('gurkha-suv');
|
|
|
147
151
|
window.CI360.update(null, true);
|
|
148
152
|
```
|
|
149
153
|
|
|
154
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-n7m04e"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
155
|
+
|
|
150
156
|
### destroy
|
|
151
157
|
|
|
152
158
|
###### Type: **Function**
|
|
@@ -156,7 +162,7 @@ Destroying a cloudimage 360 viewer instance will reset the HTML to its original
|
|
|
156
162
|
```javascript
|
|
157
163
|
window.CI360.destroy();
|
|
158
164
|
```
|
|
159
|
-
<a href="https://codesandbox.io/s/js-cloudimage-360-view-
|
|
165
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-03pb2t">
|
|
160
166
|
<img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
161
167
|
|
|
162
168
|
### getActiveIndexByID
|
|
@@ -190,10 +196,10 @@ You can customize elements by adding the following classes:
|
|
|
190
196
|
bottom: 0;
|
|
191
197
|
}
|
|
192
198
|
.cloudimage-360-magnifier-icon {
|
|
193
|
-
background: url(https://scaleflex.
|
|
199
|
+
background: url(https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/loupe.svg) 50% 50% / cover no-repeat;
|
|
194
200
|
}
|
|
195
201
|
.cloudimage-360-close-fullscreen-icon {
|
|
196
|
-
background: url(https://scaleflex.
|
|
202
|
+
background: url(https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/cross.svg) 50% 50% / cover no-repeat;
|
|
197
203
|
}
|
|
198
204
|
.cloudimage-360-view-360-circle {
|
|
199
205
|
margin: auto;
|
|
@@ -202,7 +208,7 @@ You can customize elements by adding the following classes:
|
|
|
202
208
|
margin: auto;
|
|
203
209
|
}
|
|
204
210
|
.cloudimage-360-view-360-icon {
|
|
205
|
-
background: url(
|
|
211
|
+
background: url(https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/360_view.svg) 50% 50% / cover no-repeat;
|
|
206
212
|
}
|
|
207
213
|
.cloudimage-360-box-shadow {
|
|
208
214
|
top: 0;
|
|
@@ -252,12 +258,12 @@ The filename pattern for your 360 image. Must include {index}, which the library
|
|
|
252
258
|
###### Type: **String** | Default: **image-y-{index}.jpg** | _optional_
|
|
253
259
|
The same for [data-amount-x](#data-amount-x) but for images set in Y-axis.
|
|
254
260
|
|
|
255
|
-
###
|
|
261
|
+
### data-amount-x (or amount-x)
|
|
256
262
|
###### Type: **Number** | Default: **36** | _optional_
|
|
257
263
|
|
|
258
264
|
Amount of images to load in X-axis for 360 view .
|
|
259
265
|
|
|
260
|
-
###
|
|
266
|
+
### data-amount-y (or amount-y)
|
|
261
267
|
|
|
262
268
|
###### Type: **Number** | Default: **0** | _optional_
|
|
263
269
|
|
|
@@ -322,7 +328,7 @@ Setting the height relative to the container width according to the provided rat
|
|
|
322
328
|
data-ratio="2"
|
|
323
329
|
></div>
|
|
324
330
|
```
|
|
325
|
-
<a href="https://codesandbox.io/s/js-cloudimage-360-view-
|
|
331
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-865iz5"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
326
332
|
#### `ratio`: JSON
|
|
327
333
|
Setting the height relative to the container width at any window size.
|
|
328
334
|
|
|
@@ -345,7 +351,7 @@ and 2.22 at window size less than or equal to 768px.
|
|
|
345
351
|
}'
|
|
346
352
|
></div>
|
|
347
353
|
```
|
|
348
|
-
<a href="https://codesandbox.io/s/js-cloudimage-360-view-
|
|
354
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-xzx8no"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
349
355
|
|
|
350
356
|
### data-autoplay-reverse (or autoplay-reverse)
|
|
351
357
|
|
|
@@ -427,12 +433,12 @@ Option to add list of images in x-oriantation instead of `folder` , `filename-x`
|
|
|
427
433
|
example:
|
|
428
434
|
|
|
429
435
|
```javascript
|
|
430
|
-
data-folder="https://scaleflex.
|
|
436
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/360-car/"
|
|
431
437
|
data-image-list-x='[
|
|
432
438
|
"iris-1.jpeg",
|
|
433
439
|
"iris-4.jpeg",
|
|
434
|
-
"https://scaleflex.
|
|
435
|
-
"https://scaleflex.
|
|
440
|
+
"https://scaleflex.cloudimg.io/v7/demo/360-car/iris-12.jpeg",
|
|
441
|
+
"https://scaleflex.cloudimg.io/v7/demo/360-car/iris-15.jpeg"
|
|
436
442
|
]’
|
|
437
443
|
```
|
|
438
444
|
|
|
@@ -445,12 +451,12 @@ Option to add list of images in y-oriantation instead of `folder` , `filename-y`
|
|
|
445
451
|
example:
|
|
446
452
|
|
|
447
453
|
```javascript
|
|
448
|
-
data-folder="https://scaleflex.
|
|
454
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/360-car/"
|
|
449
455
|
data-image-list-y='[
|
|
450
456
|
"iris-2-y.jpeg",
|
|
451
457
|
"iris-6-y.jpeg",
|
|
452
|
-
"https://scaleflex.
|
|
453
|
-
"https://scaleflex.
|
|
458
|
+
"https://scaleflex.cloudimg.io/v7/demo/360-car/iris-8-y.jpeg",
|
|
459
|
+
"https://scaleflex.cloudimg.io/v7/demo/360-car/iris-30-y.jpeg"
|
|
454
460
|
]’
|
|
455
461
|
```
|
|
456
462
|
### data-pointer-zoom (or pointer-zoom)
|
|
@@ -479,7 +485,7 @@ Helper class to apply lazy-loading depending on library you choose, see [Lazy lo
|
|
|
479
485
|
|
|
480
486
|
## <a name="controls"></a> Controls
|
|
481
487
|
|
|
482
|
-
You can add controls by adding elements with the following classes: **cloudimage-360-left**, **cloudimage-360-right**, **cloudimage-360-top**, **cloudimage-360-bottom
|
|
488
|
+
You can add controls by adding elements with the following classes: **cloudimage-360-left**, **cloudimage-360-right**, **cloudimage-360-top**, **cloudimage-360-bottom
|
|
483
489
|
|
|
484
490
|
### Example CSS
|
|
485
491
|
```css
|
|
@@ -528,7 +534,7 @@ You can add controls by adding elements with the following classes: **cloudimage
|
|
|
528
534
|
```html
|
|
529
535
|
<div
|
|
530
536
|
class="cloudimage-360"
|
|
531
|
-
data-folder="https://scaleflex.
|
|
537
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/360-car/"
|
|
532
538
|
data-filename-x="{index}.jpeg"
|
|
533
539
|
>
|
|
534
540
|
<button class="cloudimage-360-left"></button>
|
|
@@ -538,7 +544,31 @@ You can add controls by adding elements with the following classes: **cloudimage
|
|
|
538
544
|
</div>
|
|
539
545
|
```
|
|
540
546
|
|
|
541
|
-
<a href="https://codesandbox.io/s/js-cloudimage-360-view-
|
|
547
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-examples-npne18"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
548
|
+
|
|
549
|
+
## <a name="spin_x_y"/> Spin in X and Y axes
|
|
550
|
+
Allow the view to spin in both X, Y axes
|
|
551
|
+
### Requirements
|
|
552
|
+
We need to provide the `file-name` of the y-axis images using <a href="#data-filename-y-or-filename-y">data-filename-y</a>
|
|
553
|
+
|
|
554
|
+
Also as we did for the x-axis if we are intializing the view using <a href="#data-folder-or-folder">data-folder</a> and <a href="#data-filename-y-or-filename-y">data-filename-y</a>
|
|
555
|
+
so we need to provide <a href="#data-amount-y-or-amount-y">data-amount-y</a> which indicates the number of images on the y-axis.
|
|
556
|
+
example:
|
|
557
|
+
|
|
558
|
+
```javascript
|
|
559
|
+
<div
|
|
560
|
+
class="cloudimage-360"
|
|
561
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/360-nike/"
|
|
562
|
+
data-filename-x="nike-{index}.jpg"
|
|
563
|
+
data-filename-y="nike-y-{index}.jpg"
|
|
564
|
+
data-amount-x="35"
|
|
565
|
+
data-amount-y="36"
|
|
566
|
+
>
|
|
567
|
+
</div>
|
|
568
|
+
```
|
|
569
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-wc9j12?file=/index.html"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a></br>
|
|
570
|
+
> Note: We can initilize the view in x, y axes without providing add `data-folder`, `data-amount-y`, `data-amount-y`.</br>
|
|
571
|
+
Just we need to provide the <a href="#data-amount-y-or-amount-y">data-amount-y</a>
|
|
542
572
|
## <a name="hotspots"/> Hotspots or Markers
|
|
543
573
|
Display information about the product on specific areas. Once a hotspot is created it can be used on more than one image.
|
|
544
574
|
### Requirements
|
|
@@ -683,7 +713,7 @@ example:
|
|
|
683
713
|
```js
|
|
684
714
|
window.CI360.addHotspots("gurkha-suv", HOTSPOTS_CONFIG);
|
|
685
715
|
```
|
|
686
|
-
<a href="https://codesandbox.io/s/competent-bogdan-49b0u6
|
|
716
|
+
<a href="https://codesandbox.io/s/competent-bogdan-49b0u6"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
687
717
|
|
|
688
718
|
### data-responsive (or responsive)
|
|
689
719
|
|
|
@@ -742,11 +772,11 @@ data-filters="bright:15,contrast:30"
|
|
|
742
772
|
|
|
743
773
|
Lazy loading is not included into js-cloudimage-360-view by default. There are well thought libraries to achieve that. If you enable lazy loading in the configuration, you need to add an additional library like [lazysizes](https://github.com/aFarkas/lazysizes), [yall.js (Yet Another Lazy Loader)](https://github.com/malchata/yall.js), [lozad.js](https://github.com/ApoorvSaxena/lozad.js) to handle it.
|
|
744
774
|
|
|
745
|
-
[Implementation example with lazysizes](https://codesandbox.io/s/
|
|
775
|
+
[Implementation example with lazysizes](https://codesandbox.io/s/js-cloudimage-360-view-examples-ux850x)
|
|
746
776
|
|
|
747
|
-
[Implementation example with yall.js](https://codesandbox.io/s/
|
|
777
|
+
[Implementation example with yall.js](https://codesandbox.io/s/js-cloudimage-360-view-xjpdg1)
|
|
748
778
|
|
|
749
|
-
[Implementation example with lozad.js](https://codesandbox.io/s/
|
|
779
|
+
[Implementation example with lozad.js](https://codesandbox.io/s/js-cloudimage-360-view-examples-8iukcn)
|
|
750
780
|
|
|
751
781
|
## <a name="best-practices"/> Best practices
|
|
752
782
|
|
package/dist/ci360.utils.js
CHANGED
|
@@ -45,7 +45,7 @@ var get360ViewProps = function get360ViewProps(image) {
|
|
|
45
45
|
controlReverse: isTrue(image, 'control-reverse'),
|
|
46
46
|
stopAtEdges: isTrue(image, 'stop-at-edges'),
|
|
47
47
|
hide360Logo: isTrue(image, 'hide-360-logo'),
|
|
48
|
-
logoSrc: attr(image, 'logo-src') || 'https://scaleflex.
|
|
48
|
+
logoSrc: attr(image, 'logo-src') || 'https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/360_view.svg',
|
|
49
49
|
ratio: attr(image, 'ratio') || attr(image, 'data-ratio'),
|
|
50
50
|
imageInfo: attr(image, 'info') || attr(image, 'data-info') || isTrue(image, 'info')
|
|
51
51
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
height: 25px;
|
|
16
16
|
margin-bottom: 5px;
|
|
17
17
|
cursor: pointer;
|
|
18
|
-
background: url('https://scaleflex.
|
|
18
|
+
background: url('https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/loupe.svg') 50% 50% / cover no-repeat;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.cloudimage-360-fullscreen-icon {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
height: 25px;
|
|
24
24
|
margin-bottom: 5px;
|
|
25
25
|
cursor: pointer;
|
|
26
|
-
background: url('https://scaleflex.
|
|
26
|
+
background: url('https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/full_screen.svg') 50% 50% / cover no-repeat;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.cloudimage-360-reset-zoom-icon {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
width: 25px;
|
|
40
40
|
height: 25px;
|
|
41
41
|
cursor: pointer;
|
|
42
|
-
background: url('https://scaleflex.
|
|
42
|
+
background: url('https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/cross.svg') 50% 50% / cover no-repeat;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.cloudimage-360-loader {
|
|
@@ -7,7 +7,7 @@ exports.create360ViewCircleIcon = void 0;
|
|
|
7
7
|
|
|
8
8
|
var create360ViewCircleIcon = function create360ViewCircleIcon(circleOffset) {
|
|
9
9
|
var view360CircleIcon = new Image();
|
|
10
|
-
view360CircleIcon.src = 'https://scaleflex.
|
|
10
|
+
view360CircleIcon.src = 'https://scaleflex.cloudimg.io/v7/plugins/js-cloudimage-360-view/assets/img/360.svg';
|
|
11
11
|
view360CircleIcon.style.bottom = "".concat(circleOffset, "%");
|
|
12
12
|
view360CircleIcon.className = 'cloudimage-360-view-360-circle';
|
|
13
13
|
return view360CircleIcon;
|