Make sure Mouse, Random, Window, and Time import their native implementation.

This commit is contained in:
evancz 2013-03-13 00:00:02 -07:00
parent 3540449119
commit 1552651eaf
5 changed files with 14 additions and 2 deletions

View file

@ -1,6 +1,8 @@
module Mouse where
import Native.Mouse
-- The current mouse position.
position : Signal (Int,Int)

View file

@ -10,6 +10,7 @@ Elm.Native.Graphics.Text = function(elm) {
var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
var Color = Elm.Native.Graphics.Color(elm);
var Element = Elm.Graphics.Element(elm);
var show = Elm.Native.Show(elm).show;
function makeSpaces(s) {
if (s.length == 0) { return s; }
@ -66,6 +67,9 @@ Elm.Native.Graphics.Text = function(elm) {
function typeface(name, text) {
return addStyle('font-family', JS.fromString(name), text);
}
function monospace(text) {
return addStyle('font-family', 'monospace', text);
}
function size(px, text) { return addStyle('font-size', px + 'px', text) }
var header = addTag('h1');
function height(h, text) { return addStyle('font-size', hf+'em', text) }
@ -94,7 +98,7 @@ Elm.Native.Graphics.Text = function(elm) {
}
function asText(v) {
return position('left')(typeface('monospace', toText(show(v))));
return position('left')(monospace(toText(show(v))));
}
return elm.Native.Graphics.Text = {
@ -107,7 +111,7 @@ Elm.Native.Graphics.Text = function(elm) {
underline : underline,
overline : overline,
strikeThrough : strikeThrough,
monospace : function(text) { return typeface('monospace', text) },
monospace : monospace,
typeface : F2(typeface),
color : F2(color),
link : F2(link),

View file

@ -1,6 +1,8 @@
module Random where
import Native.Random
-- Given a range from low to high and a signal of values, this produces
-- a new signal that changes whenever the input signal changes. The new
-- values are random number between 'low' and 'high' inclusive.

View file

@ -3,6 +3,8 @@
module Time where
import Native.Time
type Time = Float
-- Units of time, making it easier to specify things like a

View file

@ -1,6 +1,8 @@
module Window where
import Native.Mouse
-- The current dimensions of the window (i.e. the area viewable to the
-- user, not including scroll bars).
dimensions : Signal (Int,Int)