diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..6f3a2913e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/activities/Fototoon.activity/js/activity.js b/activities/Fototoon.activity/js/activity.js index 035123490..872f26b9f 100644 --- a/activities/Fototoon.activity/js/activity.js +++ b/activities/Fototoon.activity/js/activity.js @@ -109,7 +109,8 @@ define(["sugar-web/activity/activity","sugar-web/datastore","sugar-web/env","tex element.src = text; } element.onload = function () { - toonModel.addImage(element.src); + toonModel.addGlobe(element.src); + // toonModel.addImage(element.src); }; }); }, { mimetype: 'image/png' }, { mimetype: 'image/jpeg' }, { activity: 'org.olpcfrance.PaintActivity'}); diff --git a/activities/Fototoon.activity/js/toon.js b/activities/Fototoon.activity/js/toon.js index d2e1a3dd2..181f61e0c 100644 --- a/activities/Fototoon.activity/js/toon.js +++ b/activities/Fototoon.activity/js/toon.js @@ -626,7 +626,7 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct }); }; - this.addGlobe = function (globeType) { + this.addGlobe = function (globeType, imageSrc) { var width = 100; var height = 50; globeData = {'globe_type': globeType, 'x': 100, 'y': 100, @@ -640,9 +640,9 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct globeData['mode'] = MODE_WHISPER; }; - var globe = new Globe(this, globeData); + var globe = new Globe(this, globeData, imageSrc); this.globes.push(globe); - this.stage.update(); + this.stage.update(imageSrc); }; this.getJson = function() { @@ -936,7 +936,7 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct }; - function Globe(box, globeData) { + function Globe(box, globeData, imageSrc) { this._box = box; this._stage = box.stage; this._shapeControls = null; @@ -1001,7 +1001,7 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct this._shape = null; }; - this.createShape = function() { + this.createShape = function(imageSrc) { if (this._shape != null) { this._stage.removeChild(this._shape); if (this._type == TYPE_CLOUD) { @@ -1019,10 +1019,10 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct this.createShapeCloud(scaled_x, scaled_y, scale_x, scale_y); } else if (this._type == TYPE_EXCLAMATION) { this.createShapeExclamation(scaled_x, scaled_y, scale_x, scale_y); - } else if (this._type == TYPE_RECTANGLE) { - this.createShapeRectangle(); - } else { + } else if (this._type == TYPE_GLOBE) { this.createShapeGlobe(scaled_x, scaled_y, scale_x, scale_y); + } else { + this.createShapeRectangle(imageSrc); }; this._shape.on('click', function(event) { @@ -1115,11 +1115,12 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct this._shape.setTransform(0, 0, scale_x, scale_y); }; - this.createShapeRectangle = function() { + this.createShapeRectangle = function(imageSrc) { var x = this._x; var y = this._y; var w = this._width; var h = this._height; + this._shape = new createjs.Shape(); this._shape.name = 'rect'; @@ -1127,7 +1128,20 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct this._shape.graphics.setStrokeStyle(LINE_WIDTH, "round", null, null, true); this._shape.graphics.beginStroke(BLACK); - this._shape.graphics.beginFill(WHITE); + + var image = document.createElement("img"); + image.crossOrigin = "Anonymous"; // Should work fine + image.src = imageSrc; + var bitmap = new createjs.Bitmap(image); + + // var bitmap = new createjs.Bitmap(image); + bitmap.x = x - w; + bitmap.y = y - h; + bitmap.scaleX = image.width; + bitmap.scaleY = image.height; + + this._shape.graphics.beginBitmapFill(bitmap.image, "no-repeat"); + if(!imageSrc) this._shape.graphics.beginFill(WHITE); this._shape.graphics.rect(x - w , y - h, w * 2, h * 2); this._shape.graphics.endStroke(); @@ -1504,8 +1518,8 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct }; }; - this.update = function() { - this.createShape(); + this.update = function(imageSrc) { + this.createShape(imageSrc); this._textViewer.update(); this.createControls(); this._stage.update(); @@ -1577,7 +1591,7 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct }; this.init(); - this.update(); + this.update(imageSrc); }; diff --git a/v2/css/styles.css b/v2/css/styles.css index 1a833f847..64caa739f 100644 --- a/v2/css/styles.css +++ b/v2/css/styles.css @@ -1333,28 +1333,4 @@ a { #toolbar-help-btn { visibility: hidden; } -} - -/*no matching activities display in listview */ -.no-matching-activities { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - display: grid; - grid-template-rows: 3; - text-align: center; -} - -.no-matching-activities > div { - display: flex; - justify-content: center; - align-items: center; - margin: 10px; -} -.clearSearchField { - padding: 10px 30px; - background-color: #808080; - border-radius: 20px; - color : white; } \ No newline at end of file diff --git a/v2/js/screens/homescreen.js b/v2/js/screens/homescreen.js index 5a7c5d0d2..1004e0b45 100644 --- a/v2/js/screens/homescreen.js +++ b/v2/js/screens/homescreen.js @@ -52,7 +52,7 @@ const HomeScreen = { :size="constant.iconSizeStandard" :x="buttonpositions.prev.x" :y="buttonpositions.prev.y" - color="512" + :color="512" isNative="true" @click="showPreviousRestrictedList" > @@ -64,7 +64,7 @@ const HomeScreen = { :size="constant.iconSizeStandard" :x="buttonpositions.next.x" :y="buttonpositions.next.y" - color="512" + :color="512" isNative="true" @click="showNextRestrictedList" > diff --git a/v2/js/screens/listview.js b/v2/js/screens/listview.js index 8a85fb286..ec3cd9b67 100644 --- a/v2/js/screens/listview.js +++ b/v2/js/screens/listview.js @@ -11,7 +11,7 @@ const ListView = { :id="'star' + activity.id" svgfile="./icons/star.svg" :color="getStarColor(activity)" - size="22" + :size="22" :x=0 :y=0 @click="toggleFavorite(activity)" @@ -21,7 +21,7 @@ const ListView = { diff --git a/v2/js/screens/loginscreen.js b/v2/js/screens/loginscreen.js index c52d68154..82bba1a06 100644 --- a/v2/js/screens/loginscreen.js +++ b/v2/js/screens/loginscreen.js @@ -344,5 +344,4 @@ const LoginScreen = { } } }, -}; - +}; \ No newline at end of file diff --git a/v2/js/screens/mainscreen.js b/v2/js/screens/mainscreen.js index c1f9802c3..f01b3261d 100644 --- a/v2/js/screens/mainscreen.js +++ b/v2/js/screens/mainscreen.js @@ -72,7 +72,7 @@
- +
Neighborhood
@@ -165,10 +165,7 @@ this.$refs.home.$refs.settings.openModal('aboutMyServerModal'); } }, - clearSearchField() { - this.$refs.searchfield.searchQuery = ''; - }, }, }; -if (typeof module !== 'undefined') module.exports = { MainScreen } +if (typeof module !== 'undefined') module.exports = { MainScreen } \ No newline at end of file