wpe-uiframework
Advanced tools
Comparing version 0.0.7 to 0.0.9
@@ -366,3 +366,5 @@ var defaultTextAttributes = { | ||
this.component.dhtml().classList.add(tag); | ||
if (tag) { | ||
this.component.dhtml().classList.add(tag); | ||
} | ||
}; | ||
@@ -374,3 +376,5 @@ | ||
this.component.dhtml().classList.remove(tag); | ||
if (tag) { | ||
this.component.dhtml().classList.remove(tag); | ||
} | ||
}; | ||
@@ -377,0 +381,0 @@ |
@@ -52,4 +52,7 @@ var WebAdapter = function() { | ||
} | ||
image.onerror = function(err) { | ||
return cb(err); | ||
}; | ||
image.onload = function() { | ||
cb(image, {renderInfo: {src: source}}); | ||
cb(null, image, {renderInfo: {src: source}}); | ||
}; | ||
@@ -56,0 +59,0 @@ image.src = source; |
@@ -24,3 +24,10 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
var bunny = stage.root.add({src: 'https://www.metrological.com/images/logo2x.png', x: 200, y: 200, rotation: 0.2, tag: 'bunny'}); | ||
bunny.on('txLoaded', function(textureSource) { | ||
console.log('loaded'); | ||
}); | ||
bunny.on('txError', function(err, textureSource) { | ||
console.log('error'); | ||
}); | ||
bunny.t('x',{duration: 10, delay: 2}); | ||
@@ -27,0 +34,0 @@ // bunny.x = 1050; |
@@ -51,3 +51,3 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
cb(canvas, {}); | ||
cb(null, canvas, {}); | ||
}, {id: id}); | ||
@@ -54,0 +54,0 @@ }; |
@@ -113,3 +113,3 @@ var gles2 = require('wpe-webgl'); | ||
ctx.drawImage(img, 0, 0, img.width, img.height); | ||
cb(canvas, {w: img.width, h: img.height}) | ||
cb(null, canvas, {w: img.width, h: img.height}) | ||
}; | ||
@@ -116,0 +116,0 @@ |
{ | ||
"author": "Metrological, Bas van Meurs <b.van.meurs@metrological.com>", | ||
"name": "wpe-uiframework", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"main": "wpe.js", | ||
@@ -6,0 +6,0 @@ "license": "apache", |
@@ -392,2 +392,3 @@ # WPE UI Framework | ||
| `isActive():Boolean` | Returns true iff this component is attached to the stage rendering tree and is visible. | | ||
| `textureIsLoaded():Boolean` | Returns true iff `this.texture` has already been loaded. | | ||
| `animation(settings:Object):TimedAnimation` | Creates and returns an animation that has this component as subject. | | ||
@@ -414,2 +415,9 @@ | `a(settings:Object):TimedAnimation` | See animation(). | | ||
### Events | ||
| Name | Arguments | Description | | ||
| --------------------------------- |---------|-------------| | ||
| `txLoad` | textureSource | `this.texture` has been loaded. | | ||
| `txError` | error, textureSource | Error while trying to load `this.texture`. | | ||
## <a name="transition"></a>Transition | ||
@@ -416,0 +424,0 @@ |
@@ -52,3 +52,3 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
// Create 'real' texture and set it. | ||
return cb(self.createTextureSource()); | ||
return cb(null, self.createTextureSource()); | ||
}); | ||
@@ -77,3 +77,3 @@ }; | ||
cb(rval.canvas, {renderInfo: renderInfo, precision: rval.renderInfo.precision}); | ||
cb(null, rval.canvas, {renderInfo: renderInfo, precision: rval.renderInfo.precision}); | ||
}, tr.settings.getTextureId()); | ||
@@ -80,0 +80,0 @@ }; |
@@ -441,3 +441,3 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
var whitePixel = new Uint8Array([255, 255, 255, 255]); | ||
return cb(whitePixel, {w: 1, h: 1}); | ||
return cb(null, whitePixel, {w: 1, h: 1}); | ||
}, id:"__whitepix"}; | ||
@@ -444,0 +444,0 @@ |
@@ -172,3 +172,9 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
textureSource.loadSource(function(source, options) { | ||
textureSource.loadSource(function(err, source, options) { | ||
if (err) { | ||
console.error('texture load error', err); | ||
textureSource.hasError(err); | ||
return; | ||
} | ||
if (self.stage.destroyed) { | ||
@@ -175,0 +181,0 @@ // Ignore |
@@ -156,2 +156,8 @@ var isNode = !!(((typeof module !== "undefined") && module.exports)); | ||
TextureSource.prototype.hasError = function(e) { | ||
this.components.forEach(function(component) { | ||
component.textureSourceHasLoadError(e); | ||
}); | ||
}; | ||
TextureSource.prototype.isAddedToTextureAtlas = function(x, y) { | ||
@@ -158,0 +164,0 @@ this.inTextureAtlas = true; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
860525
18835
504