name: "Pixelfade",
kind: "Hack",
style: "background-color: yellow; background-position: center center",
+ preferences: [
+ {name: "background", label: "Background", kind: "ListSelector", items: ['desktop wallpaper'].concat(colorList)}
+ ],
+ background: 'desktop wallpaper',
components: [
{name: "canvas", nodeTag: "canvas", onclick: "canvasClick"},
{name: "wallpaperService", kind: "PalmService",
],
create: function() {
this.inherited(arguments);
- this.$.wallpaperService.call({
- keys: ['wallpaper'],
- subscribe: false
- });
+ this.preferencesChanged();
},
rendered: function() {
this.canvas = this.$.canvas.hasNode();
hidden: function() {
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
},
+ preferencesChanged: function() {
+ if (this.background == 'desktop wallpaper') {
+ this.$.wallpaperService.call({
+ keys: ['wallpaper'],
+ subscribe: false
+ });
+ } else {
+ this.setStyle('background-image: none; background-color: ' + this.background);
+ }
+ },
canvasClick: function(inSender, inEvent) {
clearTimeout(this.fadeInTimer);
clearInterval(this.spotTimer);
},
gotWallpaper: function(inSender, inResponse) {
enyo.log("got background: " + JSON.stringify(inResponse));
- this.setStyle('background-image: url(' + inResponse.wallpaper.wallpaperFile + '); background-alignment: center center');
+ this.setStyle('background-image: url(' + inResponse.wallpaper.wallpaperFile + '); background-position: center center');
},
do_fade_spot: function() {
var x = Math.floor(Math.random() * this.canvas.width);