Skip to content

Commit

Permalink
prevent zoom controls when zoom is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ts-thomas committed May 21, 2021
1 parent 52d3941 commit 784a555
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<h1 align="center"><img src="https://cdn.jsdelivr.net/gh/nextapps-de/spotlight@master/demo/spotlight.svg" alt="Spotlight.js: Modern HTML5 Gallery for Images, Videos and Media" width="500px"><p></p></h1>
<h3>Web's most easy to integrate lightbox gallery library. Super-lightweight, outstanding performance, no dependencies.</h3>

<a target="_blank" href="https://www.npmjs.com/package/spotlight.js"><img src="https://img.shields.io/npm/v/spotlight.js.svg"></a>
<a target="_blank" href="https://github.com/nextapps-de/spotlight/issues"><img src="https://img.shields.io/github/issues/nextapps-de/spotlight.svg"></a>
<a target="_blank" href="https://www.npmjs.com/package/spotlight.js"><img src="https://img.shields.io/npm/v/spotlight.js.svg"></a><!--<a target="_blank" href="https://github.com/nextapps-de/spotlight/issues"><img src="https://img.shields.io/github/issues/nextapps-de/spotlight.svg"></a>-->
<a target="_blank" href="https://github.com/nextapps-de/spotlight/blob/master/LICENSE.md"><img src="https://img.shields.io/npm/l/spotlight.js.svg"></a>

<a href="https://nextapps-de.github.io/spotlight/">Demo</a> &ensp;&bull;&ensp; <a href="#started">Getting Started</a> &ensp;&bull;&ensp; <a href="#groups">Gallery Groups</a> &ensp;&bull;&ensp; <a href="#options">Options</a> &ensp;&bull;&ensp; <a href="#styling">Styling</a> &ensp;&bull;&ensp; <a href="#api">API</a> &ensp;&bull;&ensp; <a href="CHANGELOG.md">Changelog</a>
Expand Down
6 changes: 3 additions & 3 deletions dist/js/spotlight.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/spotlight.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spotlight.js",
"version": "0.7.71",
"version": "0.7.72",
"description": "Modern HTML5 Image Gallery",
"homepage": "https://github.com/nextapps-de/spotlight/",
"author": "Thomas Wilkerling",
Expand Down
10 changes: 6 additions & 4 deletions src/js/spotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,10 +759,12 @@ function key_listener(event){

if(panel){

const zoom_enabled = options["zoom-in"] !== false;

switch(event.keyCode){

case keycodes.BACKSPACE:
autofit();
zoom_enabled && autofit();
break;

case keycodes.ESCAPE:
Expand All @@ -784,13 +786,13 @@ function key_listener(event){
case keycodes.UP:
case keycodes.NUMBLOCK_PLUS:
case keycodes.PLUS:
zoom_in();
zoom_enabled && zoom_in();
break;

case keycodes.DOWN:
case keycodes.NUMBLOCK_MINUS:
case keycodes.MINUS:
zoom_out();
zoom_enabled && zoom_out();
break;
}
}
Expand All @@ -800,7 +802,7 @@ function wheel_listener(event){

//console.log("wheel_listener");

if(panel){
if(panel && (options["zoom-in"] !== false)){

let delta = event["deltaY"];
delta = (delta < 0 ? 1 : delta ? -1 : 0) * 0.5;
Expand Down

0 comments on commit 784a555

Please sign in to comment.