Skip to content

Commit

Permalink
Merge branch 'pr/1602' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Apr 20, 2024
2 parents 89514cc + 67580f9 commit dbaa993
Show file tree
Hide file tree
Showing 20 changed files with 200 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Message Updation in Fraction Activity #1453
- LabyrinthJS: No selection-indicator is visible while linking ideas #1585
- Gear unexpected behavior of Play toolbar icon #1600
- Add a zoom-in and zoom-out button in ColorMyWorld activity #1593

## [1.8.0] - 2024-04-10
### Added
Expand Down
23 changes: 23 additions & 0 deletions activities/ColorMyWorld.activity/css/activity.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@ body {
background-image: url(../img/pause.png);
title:'pause';
}
#zoom-button {
background-image: url(../icons/zoom.svg);
}
.zoombuttons-container {
display:flex;
}
.zoombuttons {
width:55px;
height:55px;
}
.zoombuttons:hover {
background-color: #808080;
}
#zoom-in-button {
background-image: url(../icons/zoom-in.svg);

}
#zoom-out-button {
background-image: url(../icons/zoom-out.svg);
}
#zoom-original-button {
background-image: url(../icons/zoom-original.svg);
}
#main-toolbar #help-button {
background-image: url(../icons/help.svg);
}
Expand Down
8 changes: 8 additions & 0 deletions activities/ColorMyWorld.activity/icons/zoom-in.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions activities/ColorMyWorld.activity/icons/zoom-original.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions activities/ColorMyWorld.activity/icons/zoom-out.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions activities/ColorMyWorld.activity/icons/zoom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions activities/ColorMyWorld.activity/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<button class="toolbutton" id="mode-button" title="Mode"></button>
<button class="toolbutton" id="color-button" title="Color"></button>
<button class="toolbutton" id="run-button" title="Play"></button>
<button class="toolbutton" id="zoom-button" title="Zoom"></button>

<div id="persistent_title_div"></div>

Expand Down
7 changes: 5 additions & 2 deletions activities/ColorMyWorld.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ define([
"activity/ol",
"activity/hammer.min",
"l10n",
"config","colormyworld","map","roll_up_div","util","languagepalette","sugar-web/graphics/colorpalette","filterpalette","modepalette","tutorial","sugar-web/env"
"config","colormyworld","map","roll_up_div","util","languagepalette","sugar-web/graphics/colorpalette","filterpalette","modepalette","tutorial","sugar-web/env","./palettes/zoompalette"
],
function (activity,messages,print,jquery,ol,hammer,l10n,config,colormyworld,map,rollupdiv,util,languagepalette,colorpalette,filterpalette,modepalette,tutorial,env){
function (activity,messages,print,jquery,ol,hammer,l10n,config,colormyworld,map,rollupdiv,util,languagepalette,colorpalette,filterpalette,modepalette,tutorial,env,zoompalette){

// Manipulate the DOM only when it is ready.
requirejs(['domReady!'], function (doc) {
Expand Down Expand Up @@ -74,6 +74,9 @@ define([
colormyworld.setRGBColorString(e.detail.color);
});

var zoomButton = document.getElementById("zoom-button");
var zoomButtonPalette = new zoompalette.ZoomPalette(zoomButton);

var modeButton = document.getElementById("mode-button");
modepalette = new modepalette.ModePalette(modeButton, undefined);
colormyworld.change_areaCB(true,'World');
Expand Down
5 changes: 5 additions & 0 deletions activities/ColorMyWorld.activity/js/palettes/zoompalette.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="zoombuttons-container">
<div class="zoombuttons" id = "zoom-in-button"></div>
<div class="zoombuttons" id = "zoom-out-button"></div>
<div class="zoombuttons" id = "zoom-original-button"></div>
</div>
56 changes: 56 additions & 0 deletions activities/ColorMyWorld.activity/js/palettes/zoompalette.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
define([
'sugar-web/graphics/palette',
'text!activity/palettes/zoompalette.html',
], function (palette, template) {
var zoompalette = {}
zoompalette.ZoomPalette = function (invoker, primaryText) {
palette.Palette.call(this, invoker, primaryText)
this.getPalette().id = 'zoom-palette'

var containerElem = document.createElement('div')
containerElem.innerHTML = template

this.setContent([containerElem])

var zoomIn = document.getElementById('zoom-in-button')
var zoomOut = document.getElementById('zoom-out-button')
var zoomOriginal = document.getElementById('zoom-original-button')

zoomIn.addEventListener('click', function () {
var view=window.map.getView();
var zoom = view.getZoom();
view.animate({zoom:zoom+1})
})

zoomOut.addEventListener('click', function () {
var view=window.map.getView();
var zoom = view.getZoom();
view.animate({zoom:zoom-1})
})

zoomOriginal.addEventListener('click', function () {
var view=window.map.getView();
view.animate({zoom:2.3299654139527806})
})

}

var addEventListener = function (type, listener, useCapture) {
return this.getPalette().addEventListener(type, listener, useCapture)
}

zoompalette.ZoomPalette.prototype = Object.create(
palette.Palette.prototype,
{
addEventListener: {
value: addEventListener,
enumerable: true,
configurable: true,
writable: true,
},
},
)

return zoompalette
})

5 changes: 5 additions & 0 deletions activities/ColorMyWorld.activity/lib/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ define(["l10n"], function (l10n) {
element: "#run-button",
title: l10n.get("TutoRunTitle"),
intro: l10n.get("TutoRunContent")
},
{
element: "#zoom-button",
title: l10n.get("TutoZoomTitle"),
intro: l10n.get("TutoZoomContent")
}
];

Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,7 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam"
}
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Haz clic aquí para elegir el color con el que colorear los países",
"TutoRunTitle": "Ejecutar",
"TutoRunContent": "Si has seleccionado los modos \"Interactivo\" o \"Gira\", haz clic aquí para ejecutar el juego",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Haiti clic aquí para ampliar o reducir el mapa",
"Vietnam": "Vietnam",
"Somaliland": "Somalilandia",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@
"TutoColorContent": "Cliquez ici pour choisir la couleur actuelle utilisée pour colorier les pays",
"TutoRunTitle": "Lancer",
"TutoRunContent": "Si vous avez choisi le mode de jeu Interactif ou Visite, cliquez ici pour démarrer le jeu",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Cliquez ici pour zoomer/dézoomer la carte",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "Cisjordanie"
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/gr.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/sw.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down
2 changes: 2 additions & 0 deletions activities/ColorMyWorld.activity/locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"TutoColorContent": "Click here to choose the current color to use to color countries",
"TutoRunTitle": "Run",
"TutoRunContent": "If you selected Interactive or Tour play mode, click here to start running the game",
"TutoZoomTitle": "Zoom",
"TutoZoomContent":"Click here to zoom in/zoom out the map",
"Vietnam": "Vietnam",
"Somaliland": "Somaliland",
"West_Bank": "West_Bank",
Expand Down

0 comments on commit dbaa993

Please sign in to comment.