Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework test #19

Merged
merged 47 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2595ee9
added api sample
nelabiernat Nov 21, 2023
d2f90b6
added functions again
nelabiernat Nov 23, 2023
feafb43
added functions again
nelabiernat Nov 23, 2023
1948836
change events
staybyte Nov 23, 2023
f8f1174
change events
staybyte Nov 23, 2023
f704f65
change events
staybyte Nov 23, 2023
6aed460
change events
staybyte Nov 23, 2023
c908409
changed README.md
nelabiernat Nov 23, 2023
377cce2
changed README.md
nelabiernat Nov 23, 2023
349f022
change events
staybyte Nov 23, 2023
e215201
Merge remote-tracking branch 'origin/api-sample' into api-sample
staybyte Nov 23, 2023
a190f4b
changed README.md
nelabiernat Nov 24, 2023
19a00d4
Merge branch 'main' into api-sample
nelabiernat Nov 24, 2023
33ff5c1
Merge branch 'main' into api-sample
nelabiernat Nov 24, 2023
836be4e
added api sample
nelabiernat Nov 28, 2023
f433027
testing new $FSI.createNode
nelabiernat Nov 30, 2023
82c78a1
testing new $FSI.createNode
nelabiernat Nov 30, 2023
3308deb
testing new $FSI.createNode
nelabiernat Nov 30, 2023
ce9d914
testing new $FSI.createNode
nelabiernat Nov 30, 2023
bd2670d
testing new $FSI.createNode
nelabiernat Dec 1, 2023
4d67727
testing new $FSI.createNode
nelabiernat Dec 1, 2023
8cef379
testing new $FSI.createNode
nelabiernat Dec 1, 2023
1dce8c8
change events
staybyte Dec 1, 2023
4686d91
new $FSI.createNode implemented
nelabiernat Dec 1, 2023
6328813
new $FSI.createNode implemented
nelabiernat Dec 1, 2023
d6d2155
new $FSI.createNode implemented
nelabiernat Dec 1, 2023
46174ae
added gif link
nelabiernat Dec 12, 2023
1dd9ca7
Test with framework 2.0
staybyte Feb 9, 2024
82e8016
Test with framework 2.0
staybyte Feb 15, 2024
86b2b36
Test with framework 2.0
staybyte Feb 15, 2024
e71c87f
Test with framework 2.0
staybyte Feb 15, 2024
e617c7b
testing react sample
staybyte Feb 26, 2024
04a3c3f
test react
staybyte Feb 27, 2024
88369b1
changed framework to 2.0.13
nelabiernat Feb 29, 2024
c87fe9b
changed framework to 2.0.13
nelabiernat Feb 29, 2024
d3e2d37
testing react sample
staybyte Mar 12, 2024
bcfe795
Merge remote-tracking branch 'origin/framework-test' into framework-test
staybyte Mar 12, 2024
928519f
test react
staybyte Mar 12, 2024
195d2e8
refactor sample config.yml
staybyte Mar 13, 2024
ef7d582
refactor sample config.yml
staybyte Mar 14, 2024
12922c3
changed logo
nelabiernat Mar 14, 2024
223f2d8
bump
staybyte Mar 18, 2024
15f4fad
omit jquery
nelabiernat Mar 19, 2024
0139556
update framework
nelabiernat Mar 19, 2024
7ac2aee
update framework
nelabiernat Mar 19, 2024
0738fe5
added readme
nelabiernat Mar 21, 2024
5de5fa9
added readme
nelabiernat Mar 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ yarn.lock

node_modules
dist
build
.cache

env.yml
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)][License]


The JavaScript-based viewer provides a minimalist, highly customisable user interface that is easily adaptable via CSS, supported by lightning-fast real-time image delivery from the FSI Server.
The zoom viewer provides a minimalist, highly customisable user interface that is easily adaptable via CSS, supported by lightning-fast real-time image delivery from the FSI Server.
FSI Viewer can be created and controlled as a simple HTML tag and/or via the JavaScript API.

This repository contains examples on how to use and build your own applications.

![Project Image](project.apng)
[![Project Image](project.apng)][GHPages]

## Getting Started

Expand Down
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,23 @@
"name": "NeptuneLabs GmbH",
"url": "https://www.neptunelabs.com/"
},
"version": "23.11.24",
"homepage": "https://www.neptunelabs.com/fsi-viewer",
"version": "24.03.19",
"homepage": "https://neptunelabs.com/fsi-viewer",
"repository": {
"type": "git",
"url": "https://github.com/neptunelabs/fsi-viewer-samples"
},
"license": "Apache-2.0",
"private": true,
"engines": {
"node": ">=16.0.0",
"npm": ">=6.0.0"
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"dependencies": {
"@neptunelabs/fsi-samples-framework": "^1.1.0"
},
"devDependencies": {
"prettier": "^3.0.1"
"@neptunelabs/fsi-samples-framework": "^2.0.18"
},
"scripts": {
"start": "start-sample",
"build": "start-sample --build"
"start": "workbench",
"build": "workbench --build"
}
}
1 change: 1 addition & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
title: 'FSI Viewer'
projectURL: https://www.neptunelabs.com/fsi-viewer/
originAssetPath: viewer
schema: overview-taupe
playground:
stackblitz: fsi-viewer-samples
41 changes: 16 additions & 25 deletions samples/custom-product-detail-page/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,20 @@ overview:
- JS built FSI Viewer
- zoom and pan
- custom UI
schema: bootstrap-taupe
sample:
template:
schema: framework-2023
components:
menu:
template: data/misc-menu.yml
hero: false
featured: true
footer:
credits:
photos:
- author: Brandon Atchison
link: https://unsplash.com/@b_atchison98?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
fsi:
viewer: true
bootstrap:
icons: false
mapping:
html: "index.html"
css: "style.css"
js: "script.js"
playground:
deploy: true
menu:
data: misc-menu.yml
featured: true
footer:
credits:
photos:
- author: Brandon Atchison
link: https://unsplash.com/@b_atchison98?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
fsi:
viewer: true
bootstrap:
icons: false
48 changes: 20 additions & 28 deletions samples/external-buttons/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,24 @@ overview:
- JS built FSI Viewer
- external UI
- zoom and pan
schema: bootstrap-taupe
sample:
template:
schema: framework-2023
components:
menu:
template: data/clothing-menu.yml
featured:
template: data/clothing-featured.yml
highlight: DEAL OF THE DAY
footer:
credits:
photos:
- author: Kate Skumen
link: https://unsplash.com/@skumen?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
hero: false
fsi:
viewer: true
bootstrap:
icons: true
jquery: true
mapping:
html: "index.html"
css: "style.css"
js: "script.js"
playground:
deploy: true
menu:
data: clothing-menu.yml
featured:
data: clothing-featured.yml
highlight: DEAL OF THE DAY
footer:
credits:
photos:
- author: Kate Skumen
link: https://unsplash.com/@skumen?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
hero: false
fsi:
viewer: true
bootstrap:
icons: true

54 changes: 23 additions & 31 deletions samples/external-slider/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,27 @@ overview:
- JS built FSI Viewer
- external slider
- zoom and pan
schema: bootstrap-taupe
sample:
template:
schema: framework-2023
components:
menu:
template: data/misc-menu.yml
highlight: DEAL OF THE DAY
featured: true
footer:
credits:
photos:
- author: Jonny Caspari
link: https://unsplash.com/@jonnysplsh?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
- author: max fuchs
link: https://unsplash.com/@designfuchs?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
- author: William Moreland
link: https://unsplash.com/@relentlessjpg?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
fsi:
viewer: true
bootstrap:
icons: false
mapping:
html: "index.html"
css: "style.css"
js: "script.js"
playground:
deploy: true
menu:
data: misc-menu.yml
highlight: DEAL OF THE DAY
featured: true
footer:
credits:
photos:
- author: Jonny Caspari
link: https://unsplash.com/@jonnysplsh?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
- author: max fuchs
link: https://unsplash.com/@designfuchs?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
- author: William Moreland
link: https://unsplash.com/@relentlessjpg?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
fsi:
viewer: true
bootstrap:
icons: false
110 changes: 110 additions & 0 deletions samples/javascript-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# JS API Sample

FSI Viewer contains an extensive JS API with methods and callbacks that you can use.
You can find [an overview of all available parameters in the corresponding documentation](https://docs.neptunelabs.com/docs/fsi-viewer/js-api/public-methods).

This example is a simple demonstration of how to use these methods and callbacks.

To display zoom with FSI Viewer, all you need to do is add the following script to the top of your web page:

```html
<script
src='https://fsi.domain.tld/fsi/viewer/applications/viewer/js/fsiviewer.js'
</script>
```
This will ensure that the FSI Viewer is loaded.

Normally you would need to place the *<fsi-viewer>* tag in your source code where you want the viewer to be displayed.

In this example, we only want to display the viewer in place of an image when a button is clicked.
This means that the viewer is initialised by JavaScript.

To do this, we have created this part in the body:

```html
<div class="col productContainer" id="productContainer">
<img id="zoomImg" src="{{&fsi.server}}/{{&fsi.context}}/server?type=image&source=images/samples/Shoe/View2/sneaker-both-13.jpg&width=640&height=397&effects=pad(CC,FFFFFF)" height="397" alt="">
<div class="zoomContainer" id="zoomEle">
</div>
<button type="button" id="zoomBtn" class="btn btn-lg btn-outline-dark">Show Zoom</button>
</div>
```
`productContainer` is the div that contains all the elements.
`zoomImg` is the image that will be displayed on load and replaced by the viewer.
The `zoomEle` div will contain the FSI viewer.
The `zoomBtn` button is used to switch from the image to the viewer.

In the corresponding `style.css` the image and button are placed above the viewer div with `z-index`:

```css
.productContainer .img {
z-index: 10;
position: absolute;
}

.productContainer .btn {
position: absolute;
z-index: 15;
}
```

The switch on button click is achieved via JS in the corresponding `script.js`:

```js
document.addEventListener('DOMContentLoaded', () => {

document.getElementById('zoomBtn').addEventListener('click', () => {

let showTeaser = true
const teaserZoomPercent = 10

const show = () => {
// show FSI Viewer instance and hide image
document.getElementById('zoomEle').style.visibility = 'visible'
document.getElementById('zoomImg').style.display = 'none'
document.getElementById('zoomBtn').style.display = 'none'
if (showTeaser) {
setTimeout(() => {
instance.setZoom(teaserZoomPercent, true, true)
}, 500)
}
}

const instance = $FSI.createNode("fsi-viewer", {
src: 'images/samples/Shoe/View2/sneaker-both-13.jpg',
debug: false,
plugins: 'fullScreen',
skin: 'example',
width: '640',
height: '427',
id : 'myViewer',
onReady : show,
onViewChanged: (view) => {
if (showTeaser) {
showTeaser = false
setTimeout(() => {
// reset viewer - the user can interact with the UI
instance.resetView()
}, 800)
}
},
})
document.getElementById('zoomEle').appendChild(instance)
})

})

```

A click on the `zoomBtn` element will initialise a new FSI Viewer element in the `zoomEle` element.

The viewer itself is created with `$FSI.createNode("fsi-viewer",{parameters})`.

We create `show` that is called when the `onReady` callback is executed (see [documentation](https://docs.neptunelabs.com/docs/fsi-viewer/js-api/callbacks#onready)) we ensure a smooth transition:
Only when the viewer is ready will the viewer element will be set to visible, while the image and button are set to `display:none`.

If `showTeaser` is true, the method `setZoom` will be executed: `instance.setZoom(teaserZoomPercent, true, true)` (see [documentation](https://docs.neptunelabs.com/docs/fsi-viewer/js-api/public-methods#setzoom)).

For initialization, we use `$FSI.createNode` which creates the <fsi-viewer> custom tag which is appended to the `zoomEle` element.

The callback `onViewChanged` (see [documentation](https://docs.neptunelabs.com/docs/fsi-viewer/js-api/callbacks#onviewchanged)) listens when the zoom is finished, sets `showTeaser` to false and uses the `resetView` method (see [documentation](https://docs.neptunelabs.com/docs/fsi-viewer/js-api/public-methods#resetview)).
27 changes: 27 additions & 0 deletions samples/javascript-api/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
overview:
title: JavaScript API
image: logo.png
description: Learn how to use the JavaScript Viewer API with a simple demo.
order: 97
facts:
- JS built FSI Viewer
- JS API Demonstration
schema: bootstrap-taupe
sample:
menu:
data: clothing-menu.yml
featured:
data: clothing-featured.yml
highlight: DEAL OF THE DAY
footer:
credits:
photos:
- author: Artem Bondarchuk
link: https://unsplash.com/@artembondarchuk?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
platform: Unsplash
viewer:
link: https://www.neptunelabs.com/fsi-viewer/
fsi:
viewer: true
bootstrap:
icons: true
31 changes: 31 additions & 0 deletions samples/javascript-api/container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div class="container">
<div class="row row-cols-1 row-cols-lg-2 g-3 pr-5 py-3">
<div class="col productContainer" id="productContainer">
<img id="zoomImg" src="{{&fsi.server}}/{{&fsi.context}}/server?type=image&source=images/samples/Shoe/View2/sneaker-both-13.jpg&width=640&height=397&effects=pad(CC,FFFFFF)" height="397" alt="">
<div class="zoomContainer" id="zoomEle">
</div>
<button type="button" id="zoomBtn" class="btn btn-lg btn-outline-dark">Show Zoom</button>
</div>
<div class="col mx-auto">
<div class="p-3 text-left">
<h2 class="display-5">Camu</h2>
<p>Sneaker, Camouflage Suede</p>
<p></p>
<p>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-half"></i>
<small>(4664) Ratings</small>
</p>
<p>Sturdy, classy and minimal.</p>
<p>Nice shoe for any occasion. The minimal design fits a lot of outfits.</p>
<p>
<small>Dispatched in 4 working days</small>
</p>
</div>
</div>
</div>
</div>

Binary file added samples/javascript-api/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading