Merge pull request #317 from Sheeo/dev-patch

[Cosmetic] Whitespace/indentation fixes in JS runtime
This commit is contained in:
Evan Czaplicki 2013-10-31 07:31:42 -07:00
commit 0ec031440a
4 changed files with 49 additions and 52 deletions

View file

@ -152,11 +152,11 @@ function initGraphics(elm, Module) {
signalGraph = Signal.constant(signalGraph);
}
var currentScene = signalGraph.value;
// Add the currentScene to the DOM
var Render = ElmRuntime.use(ElmRuntime.Render.Element);
elm.node.appendChild(Render.render(currentScene));
// set up updates so that the DOM is adjusted as necessary.
function domUpdate(newScene, currentScene) {
ElmRuntime.draw(function(_) {
@ -174,4 +174,4 @@ function initGraphics(elm, Module) {
return renderer;
}
}());
}());

View file

@ -144,13 +144,13 @@ function renderForm(redo, ctx, form) {
case 'FPath' : drawLine(ctx, f._0, f._1); break;
case 'FImage': drawImage(redo, ctx, f); break;
case 'FShape':
if (f._0.ctor === 'Left') {
f._1.closed = true;
drawLine(ctx, f._0._0, f._1);
} else {
drawShape(redo, ctx, f._0._0, f._1);
}
break;
if (f._0.ctor === 'Left') {
f._1.closed = true;
drawLine(ctx, f._0._0, f._1);
} else {
drawShape(redo, ctx, f._0._0, f._1);
}
break;
}
ctx.restore();
}
@ -297,7 +297,7 @@ function updateTracker(w,h,div) {
container.style.overflow = 'hidden';
container.style.position = 'absolute';
addTransform(container.style, 'scaleY(-1)');
var kid = kids[i];
kid ? div.insertBefore(container, kid)
: div.appendChild(container);

View file

@ -314,4 +314,4 @@ function updateProps(node, curr, next) {
return { render:render, update:update };
};
};

View file

@ -1,48 +1,45 @@
ElmRuntime.Render.Utils = function() {
function newElement(elementType) {
var e = document.createElement(elementType);
e.style.padding = "0";
e.style.margin = "0";
return e;
}
function newElement(elementType) {
var e = document.createElement(elementType);
e.style.padding = "0";
e.style.margin = "0";
return e;
}
function addTo(container, elem) {
container.appendChild(elem);
}
function addTo(container, elem) {
container.appendChild(elem);
}
function extract(c) {
if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }
return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';
}
function extract(c) {
if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }
return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';
}
function addTransform(style, trans) {
style.transform = trans;
style.msTransform = trans;
style.MozTransform = trans;
style.webkitTransform = trans;
style.OTransform = trans;
}
function addTransform(style, trans) {
style.transform = trans;
style.msTransform = trans;
style.MozTransform = trans;
style.webkitTransform = trans;
style.OTransform = trans;
}
function removeTransform(style) {
style.transform = 'none';
style.msTransform = 'none';
style.MozTransform = 'none';
style.webkitTransform = 'none';
style.OTransform = 'none';
}
function removeTransform(style) {
style.transform = 'none';
style.msTransform = 'none';
style.MozTransform = 'none';
style.webkitTransform = 'none';
style.OTransform = 'none';
}
var List = Elm.Native.List.make({});
var List = Elm.Native.List.make({});
return {addTo:addTo,
newElement:newElement,
extract : extract,
fromList: List.toArray,
fromString: function(s) { return s; },
toString: function(s) { return s; },
eq: Elm.Native.Utils.make({}).eq,
addTransform: addTransform,
removeTransform: removeTransform
};
return {addTo:addTo,
newElement:newElement,
extract : extract,
fromList: List.toArray,
fromString: function(s) { return s; },
toString: function(s) { return s; },
eq: Elm.Native.Utils.make({}).eq,
addTransform: addTransform,
removeTransform: removeTransform};
};