Adds options to disable scratch canvases logging

This commit is contained in:
Yury Delendik 2015-05-11 07:57:02 -05:00
Родитель e81c24367a
Коммит c9a7f2695b
3 изменённых файлов: 24 добавлений и 7 удалений

Просмотреть файл

@ -200,12 +200,11 @@ Promise.all([gfxReady, playerReady]).then(function () {
createOptionsGUI();
gfxWindow.assetListContainer = document.getElementById("assetList");
gfxWindow.scratchCanvasContainer = document.getElementById("scratchCanvasContainer");
setRelease(state.release);
gfxWindow.resizeEaselContainer(state.width, state.height);
gfxWindow.setLogAssets(state.logAssets);
gfxWindow.setLogAssets(state.logAssets, document.getElementById("assetList"));
gfxWindow.setLogScratchCanvases(state.logScratchCanvases,
document.getElementById("scratchCanvasContainer"));
if (state.profileStartup && state.profileStartupDuration > 0) {
profiler.start(performance.now(), state.profileStartupDuration, false);
@ -231,7 +230,11 @@ document.addEventListener('inspectorOptionsChanged', function (e) {
setRelease(state.release);
break;
case 'logAssets':
gfxWindow.setLogAssets(state.logAssets);
gfxWindow.setLogAssets(state.logAssets, document.getElementById("assetList"));
break;
case 'logScratchCanvases':
gfxWindow.setLogScratchCanvases(state.logScratchCanvases,
document.getElementById("scratchCanvasContainer"));
break;
case 'overlayFlash':
gfxWindow.setFlashOverlayState(state.overlayFlash);

Просмотреть файл

@ -38,8 +38,15 @@ function setProfile(enabled) {
}
var logAssets = false;
function setLogAssets(enabled) {
function setLogAssets(enabled, assetListContainer_) {
logAssets = enabled;
assetListContainer = assetListContainer_;
}
var logScratchCanvases = false;
function setLogScratchCanvases(enabled, scratchCanvasContainer_) {
logScratchCanvases = enabled;
scratchCanvasContainer = scratchCanvasContainer_;
}
function resizeEaselContainer(width, height) {
@ -168,8 +175,13 @@ HTMLCanvasElement.prototype.getContext = function getContext(contextId, args) {
var scratchCanvasContainer;
function registerScratchCanvas(scratchCanvas) {
if (scratchCanvasContainer) {
if (logScratchCanvases) {
scratchCanvasContainer.appendChild(scratchCanvas);
} else {
// Temporary hack to work around a bug that prevents SVG filters to work for off-screen canvases.
// TODO remove
scratchCanvas.style.display = 'none';
document.body.appendChild(scratchCanvas);
}
}

Просмотреть файл

@ -26,6 +26,7 @@ var stateDefaults = {
logToConsole: false,
logToDebugPanel: false,
logAssets: false,
logScratchCanvases: false,
overlayFlash: false,
fileReadChunkSize: 0,
mute: false,
@ -84,6 +85,7 @@ function createOptionsGUI() {
inspectorOptions.add(state, "logToConsole").onChange(saveInspectorOption);
inspectorOptions.add(state, "logToDebugPanel").onChange(saveInspectorOption);
inspectorOptions.add(state, "logAssets").onChange(saveInspectorOption);
inspectorOptions.add(state, "logScratchCanvases").onChange(saveInspectorOption);
inspectorOptions.add(state, "profileStartup").onChange(saveInspectorOption);
inspectorOptions.add(state, "profileStartupDuration").onChange(saveInspectorOption);
inspectorOptions.add(state, "overlayFlash").onChange(saveInspectorOption);