diff --git a/bundles/framework/publisher2/resources/locale/en.js b/bundles/framework/publisher2/resources/locale/en.js index bf8924c507..95fa5c84c8 100755 --- a/bundles/framework/publisher2/resources/locale/en.js +++ b/bundles/framework/publisher2/resources/locale/en.js @@ -69,7 +69,6 @@ Oskari.registerLocalization( "LayerSelectionPlugin": "Map layers menu", "MapLegend": "Show map legend", "MapRotator": "Enable map rotation", - "TimeControl3d": "Time control", "toolbarToolNames": { "history": "Move to previous or next view", "history_back": "Move to previous view", diff --git a/bundles/framework/publisher2/resources/locale/fi.js b/bundles/framework/publisher2/resources/locale/fi.js index d6e904b2b7..ca2b832d39 100755 --- a/bundles/framework/publisher2/resources/locale/fi.js +++ b/bundles/framework/publisher2/resources/locale/fi.js @@ -69,7 +69,6 @@ Oskari.registerLocalization( "LayerSelectionPlugin": "Karttatasovalikko", "MapLegend": "Näytä karttaselitteet", "MapRotator": "Salli kartan pyörittäminen", - "TimeControl3d": "Ajanhetken säädin", "toolbarToolNames": { "history": "Siirtyminen edelliseen ja seuraavaan näkymään", "history_back": "Siirtyminen edelliseen näkymään", diff --git a/bundles/framework/publisher2/resources/locale/sv.js b/bundles/framework/publisher2/resources/locale/sv.js index 51d254c153..6fc82de51d 100755 --- a/bundles/framework/publisher2/resources/locale/sv.js +++ b/bundles/framework/publisher2/resources/locale/sv.js @@ -69,7 +69,6 @@ Oskari.registerLocalization( "LayerSelectionPlugin": "Kartlagermeny", "MapLegend": "Visa kartförklaringen", "MapRotator": "Tillåt kartrotation", - "TimeControl3d": "Tidskontroll", "toolbarToolNames": { "history": "Gå bakåt eller framåt", "history_back": "Gå bakåt", diff --git a/bundles/mapping/time-control-3d/resources/locale/en.js b/bundles/mapping/time-control-3d/resources/locale/en.js index da8b088500..d7798128be 100644 --- a/bundles/mapping/time-control-3d/resources/locale/en.js +++ b/bundles/mapping/time-control-3d/resources/locale/en.js @@ -10,6 +10,9 @@ Oskari.registerLocalization( "slow": "Slow", "normal": "Normal", "fast": "Fast" + }, + "publisher": { + "toolLabel": "Time control" } } } diff --git a/bundles/mapping/time-control-3d/resources/locale/fi.js b/bundles/mapping/time-control-3d/resources/locale/fi.js index bf2f624f47..46bb13f277 100644 --- a/bundles/mapping/time-control-3d/resources/locale/fi.js +++ b/bundles/mapping/time-control-3d/resources/locale/fi.js @@ -10,6 +10,9 @@ Oskari.registerLocalization( "slow": "Hidas", "normal": "Normaali", "fast": "Nopea" + }, + "publisher": { + "toolLabel": "Ajanhetken säädin" } } } diff --git a/bundles/mapping/time-control-3d/resources/locale/sv.js b/bundles/mapping/time-control-3d/resources/locale/sv.js index 1e4351cdd8..b7439addd4 100644 --- a/bundles/mapping/time-control-3d/resources/locale/sv.js +++ b/bundles/mapping/time-control-3d/resources/locale/sv.js @@ -10,6 +10,9 @@ Oskari.registerLocalization( "slow": "Långsam", "normal": "Normal", "fast": "Snabb" + }, + "publisher": { + "toolLabel": "Tidskontroll" } } } diff --git a/bundles/mapping/time-control-3d/tool/TimeControl3dTool.js b/bundles/mapping/time-control-3d/tool/TimeControl3dTool.js index 71280288bf..a4f72ef01f 100644 --- a/bundles/mapping/time-control-3d/tool/TimeControl3dTool.js +++ b/bundles/mapping/time-control-3d/tool/TimeControl3dTool.js @@ -1,46 +1,59 @@ -Oskari.clazz.define('Oskari.mapping.time-control-3d.TimeControl3dTool', - function () { - }, { - index: 2, - lefthanded: 'top left', - righthanded: 'top right', - groupedSiblings: true, - /** - * Get tool object. - * @method getTool - * - * @returns {Object} tool description - */ - getTool: function () { +import { AbstractPublisherTool } from '../../../framework/publisher2/tools/AbstractPublisherTool'; + +class TimeControl3dTool extends AbstractPublisherTool { + constructor (...args) { + super(...args); + this.index = 180; + this.group = 'tools'; + this.lefthanded = 'top left'; + this.righthanded = 'top right'; + this.groupedSiblings = true; + }; + + /** + * Get tool object. + * @method getTool + * + * @returns {Object} tool description + */ + getTool () { + return { + id: 'Oskari.mapping.time-control-3d.TimeControl3dPlugin', + title: Oskari.getMsg('TimeControl3d', 'publisher.toolLabel'), + config: this.state?.pluginConfig || {} + }; + } + + /** + * Get values. + * @method getValues + * @public + * + * @returns {Object} tool value object + */ + getValues () { + if (this.state.enabled) { return { - id: 'Oskari.mapping.time-control-3d.TimeControl3dPlugin', - title: 'TimeControl3d', - config: {} - }; - }, - /** - * Get values. - * @method getValues - * @public - * - * @returns {Object} tool value object - */ - getValues: function () { - if (this.state.enabled) { - return { - configuration: { - mapfull: { - conf: { - plugins: [{ id: this.getTool().id, config: this.getPlugin().getConfig() }] - } + configuration: { + mapfull: { + conf: { + plugins: [{ id: this.getTool().id, config: this.getPlugin().getConfig() }] } } - }; - } else { - return null; - } + } + }; + } else { + return null; } - }, { - 'extend': ['Oskari.mapframework.publisher.tool.AbstractPluginTool'], - 'protocol': ['Oskari.mapframework.publisher.Tool'] - }); + } +} + +// Attach protocol to make this discoverable by Oskari publisher +Oskari.clazz.defineES('Oskari.publisher.TimeControl3dTool', + TimeControl3dTool, + { + protocol: ['Oskari.mapframework.publisher.Tool'] + } +); + +export { TimeControl3dTool };