@stories-js/core
Version:
Stories web components to build stories
37 lines • 1.18 kB
JavaScript
/*!
* (C) StoriesJS https://storiesjs.org - GPL-2.0 License
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h } from '@stencil/core';
import { state } from '../../store';
export class ToolZoom {
actionHandler(event) {
const command = event.detail.command;
// Update zoom property in the Store's state
if (command === "zoomIn") {
state.zoom += 0.1;
}
else if (command === "zoomOut") {
state.zoom -= 0.1;
}
else {
state.zoom = 1;
}
}
render() {
return [
h("stories-tool-button", { command: "zoomIn", icon: "zoomIn", onStoriesAction: this.actionHandler }),
h("stories-tool-button", { command: "zoomOut", icon: "zoomOut", onStoriesAction: this.actionHandler }),
h("stories-tool-button", { command: "zoomReset", icon: "zoomReset", onStoriesAction: this.actionHandler }),
];
}
static get is() { return "stories-tool-zoom"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["tool-zoom.scss"]
}; }
static get styleUrls() { return {
"$": ["tool-zoom.css"]
}; }
}
//# sourceMappingURL=tool-zoom.js.map