11package javascripts
22
33import virtualization .lms .common ._
4- import js ._
4+ import scala .js .language ._
5+ import scala .js .language .dom .Dom
6+ import scala .js .exp ._
7+ import scala .js .exp .dom .DomExp
8+ import scala .js .gen .js ._
9+ import scala .js .gen .js .dom .GenDom
510
611// Handle exploration of a mind map (zooming and moving)
712trait Exploration extends JS with ExtraJS {
8- type ViewState = JSLiteral { val s : Double ; val tx : Double ; val ty : Double }
13+ type ViewState = Record { val s : Double ; val tx : Double ; val ty : Double }
914
1015 def setup (ps : Rep [Double ], px : Rep [Double ], py : Rep [Double ], urlUpdate : Rep [((Double , Double , Double )) => String ]) = for {
1116 workspace <- document.find(" .workspace" )
@@ -17,7 +22,7 @@ trait Exploration extends JS with ExtraJS {
1722 // Update url and svg transformation according to the current view state
1823 val updateTransform = fun { (scale : Rep [Double ], translateX : Rep [Double ], translateY : Rep [Double ]) =>
1924 workspace.setAttribute(" transform" , " scale(" + scale / 100.0 + " ) translate(" + translateX + " " + translateY + " )" )
20- history.replaceState(new JSLiteral { val s = scale; val tx = translateX; val ty = translateY }, " " , urlUpdate(scale, translateX, translateY))
25+ history.replaceState(new Record { val s = scale; val tx = translateX; val ty = translateY }, " " , urlUpdate(scale, translateX, translateY))
2126 }
2227
2328 // History events
@@ -68,30 +73,30 @@ trait Exploration extends JS with ExtraJS {
6873
6974// --- Helper to integrate external API
7075
71- trait ExternApi { this : Base with JSProxyBase =>
76+ trait ExternApi { this : Base with Proxy =>
7277 import language .{higherKinds , implicitConversions }
7378 type Extern [A ] <: Rep [A ]
7479 implicit def externToApi [A <: AnyRef : Manifest ](f : Extern [A ]): A = repProxy[A ](f) // Han, all function calls will be considered effectful…
7580}
7681
77- trait ExternApiExp extends ExternApi { this : BaseExp with JSProxyExp =>
82+ trait ExternApiExp extends ExternApi { this : BaseExp with ProxyExp =>
7883 abstract class Extern [A : Manifest ] extends Exp [A ]
7984}
8085
8186// --- Math JavaScript standard API
8287
83- trait JSMath { this : Base with ExternApi with JSProxyBase =>
88+ trait JSMath { this : Base with ExternApi with Proxy =>
8489 trait Math {
8590 def round (x : Rep [Double ]): Rep [Double ]
8691 }
8792 val Math : Extern [Math ]
8893}
8994
90- trait JSMathExp extends JSMath { this : BaseExp with ExternApiExp with JSProxyExp =>
95+ trait JSMathExp extends JSMath { this : BaseExp with ExternApiExp with ProxyExp =>
9196 object Math extends Extern [Math ]
9297}
9398
94- trait JSGenMath extends JSGenBase {
99+ trait JSGenMath extends GenBase {
95100 val IR : BaseExp with JSMath
96101 import IR ._
97102
@@ -101,8 +106,8 @@ trait JSGenMath extends JSGenBase {
101106 }
102107}
103108
104- trait ExtraJS extends JSMath with JSDom with OptionOps with ExternApi with JSProxyBase with Casts with LiftVariables with Variables
105- trait ExtraJSExp extends JSMathExp with JSDomExp with OptionOpsExp with ExternApiExp with JSProxyExp with CastsCheckedExp
106- trait JSGenExtra extends JSGenMath with JSGenDom with JSGenOptionOps with JSGenProxy with GenCastChecked {
109+ trait ExtraJS extends JSMath with Dom with OptionOps with ExternApi with Proxy with Casts with LiftVariables with Variables
110+ trait ExtraJSExp extends JSMathExp with DomExp with OptionOpsExp with ExternApiExp with ProxyExp with CastsCheckedExp
111+ trait JSGenExtra extends JSGenMath with GenDom with GenOptionOps with GenProxy with GenCastChecked {
107112 val IR : ExtraJSExp
108113}
0 commit comments