Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/platforms/browser/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ var Document = Class(lib.PubSub, function () {
overflow: 'hidden',
width: '100%',
height: '100%',
transform: 'skewx(0.00001deg)'
}
});

Expand Down
13 changes: 8 additions & 5 deletions src/platforms/browser/webgl/WebGLContext2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ var GLManager = Class(function() {
this._canvas = document.createElement('canvas');
this._canvas.width = this.width;
this._canvas.height = this.height;
this._canvas.getWebGLContext = this._canvas.getContext.bind(this._canvas, 'webgl', {
alpha: true,
premultipliedAlpha: true,
preserveDrawingBuffer: true
});

var webGLContextOptions = merge({ premultipliedAlpha: true }, CONFIG.webGLContextOptions, {
alpha: true,
preserveDrawingBuffer: true,
antialias: false
});

this._canvas.getWebGLContext = this._canvas.getContext.bind(this._canvas, 'webgl', webGLContextOptions);

this._indexCache = new Uint16Array(MAX_BATCH_SIZE * 6);
this._vertexCache = new ArrayBuffer(MAX_BATCH_SIZE * STRIDE * 4);
Expand Down
14 changes: 12 additions & 2 deletions src/ui/resource/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ var Loader = Class(Emitter, function () {
return;
}

var next = function (failed) {
var next = bind(this, function (failed) {
// If already complete, stub this out
if (numLoaded >= numResources) { return; }

Expand All @@ -440,6 +440,11 @@ var Loader = Class(Emitter, function () {
// Call the progress callback with isComplete == true
cb && cb(src, failed, true, numLoaded, numResources);

// Emit progress event
this.emit('progress', {
progress: this.progress
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work for native ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it just emits events on loader which inherits from Emitter. Just to be sure, I tested a build on android and the events came through.


// If a timeout was set, clear it
if (_timeout) {
clearTimeout(_timeout);
Expand All @@ -452,10 +457,15 @@ var Loader = Class(Emitter, function () {
// Call the progress callback with the current progress
cb && cb(src, failed, false, numLoaded, numResources);

// Emit progress event
this.emit('progress', {
progress: this.progress
});

// Restart on next image in list
setTimeout(loadResource, 0);
}
};
});

// IF this is the type of resource that has a reload method,
if (res.reload && res.complete) {
Expand Down