Make sure Mouse, Random, Window, and Time import their native implementation.
This commit is contained in:
parent
3540449119
commit
1552651eaf
5 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
module Mouse where
|
module Mouse where
|
||||||
|
|
||||||
|
import Native.Mouse
|
||||||
|
|
||||||
-- The current mouse position.
|
-- The current mouse position.
|
||||||
position : Signal (Int,Int)
|
position : Signal (Int,Int)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ Elm.Native.Graphics.Text = function(elm) {
|
||||||
var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
|
var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
|
||||||
var Color = Elm.Native.Graphics.Color(elm);
|
var Color = Elm.Native.Graphics.Color(elm);
|
||||||
var Element = Elm.Graphics.Element(elm);
|
var Element = Elm.Graphics.Element(elm);
|
||||||
|
var show = Elm.Native.Show(elm).show;
|
||||||
|
|
||||||
function makeSpaces(s) {
|
function makeSpaces(s) {
|
||||||
if (s.length == 0) { return s; }
|
if (s.length == 0) { return s; }
|
||||||
|
@ -66,6 +67,9 @@ Elm.Native.Graphics.Text = function(elm) {
|
||||||
function typeface(name, text) {
|
function typeface(name, text) {
|
||||||
return addStyle('font-family', JS.fromString(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) }
|
function size(px, text) { return addStyle('font-size', px + 'px', text) }
|
||||||
var header = addTag('h1');
|
var header = addTag('h1');
|
||||||
function height(h, text) { return addStyle('font-size', hf+'em', text) }
|
function height(h, text) { return addStyle('font-size', hf+'em', text) }
|
||||||
|
@ -94,7 +98,7 @@ Elm.Native.Graphics.Text = function(elm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function asText(v) {
|
function asText(v) {
|
||||||
return position('left')(typeface('monospace', toText(show(v))));
|
return position('left')(monospace(toText(show(v))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return elm.Native.Graphics.Text = {
|
return elm.Native.Graphics.Text = {
|
||||||
|
@ -107,7 +111,7 @@ Elm.Native.Graphics.Text = function(elm) {
|
||||||
underline : underline,
|
underline : underline,
|
||||||
overline : overline,
|
overline : overline,
|
||||||
strikeThrough : strikeThrough,
|
strikeThrough : strikeThrough,
|
||||||
monospace : function(text) { return typeface('monospace', text) },
|
monospace : monospace,
|
||||||
typeface : F2(typeface),
|
typeface : F2(typeface),
|
||||||
color : F2(color),
|
color : F2(color),
|
||||||
link : F2(link),
|
link : F2(link),
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
module Random where
|
module Random where
|
||||||
|
|
||||||
|
import Native.Random
|
||||||
|
|
||||||
-- Given a range from low to high and a signal of values, this produces
|
-- 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
|
-- a new signal that changes whenever the input signal changes. The new
|
||||||
-- values are random number between 'low' and 'high' inclusive.
|
-- values are random number between 'low' and 'high' inclusive.
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
module Time where
|
module Time where
|
||||||
|
|
||||||
|
import Native.Time
|
||||||
|
|
||||||
type Time = Float
|
type Time = Float
|
||||||
|
|
||||||
-- Units of time, making it easier to specify things like a
|
-- Units of time, making it easier to specify things like a
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
module Window where
|
module Window where
|
||||||
|
|
||||||
|
import Native.Mouse
|
||||||
|
|
||||||
-- The current dimensions of the window (i.e. the area viewable to the
|
-- The current dimensions of the window (i.e. the area viewable to the
|
||||||
-- user, not including scroll bars).
|
-- user, not including scroll bars).
|
||||||
dimensions : Signal (Int,Int)
|
dimensions : Signal (Int,Int)
|
||||||
|
|
Loading…
Reference in a new issue