Created
February 11, 2018 21:56
-
-
Save jonschull/1249d5970ad6c671a94bc8ba439b253c to your computer and use it in GitHub Desktop.
handleVents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function() { var __rt=srequire('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func; var RS_modules = {}; | |
RS_modules.pythonize = {}; | |
(function() { | |
function strings() { | |
var string_funcs, exclude, name; | |
string_funcs = set("capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase center count endswith startswith find rfind index rindex format join ljust rjust partition rpartition replace split rsplit splitlines zfill".split(" ")); | |
if (!arguments.length) { | |
exclude = (function() { | |
var s = RS_set(); | |
s.jsset.add("split"); | |
s.jsset.add("replace"); | |
return s; | |
})(); } | |
else if (arguments[0]) { | |
exclude = Array.prototype.slice.call(arguments); } | |
else { | |
exclude = null; } ; | |
if (exclude) { | |
string_funcs = string_funcs.difference(set(exclude)); } ; | |
var RS_Iter0 = RS_Iterable(string_funcs); | |
for (var RS_Index0 = 0; RS_Index0["<"](RS_Iter0.length); RS_Index0++) { | |
name = RS_Iter0[RS_Index0]; | |
(RS_expr_temp = String.prototype)[((((typeof name === "number") && name["<"](0))) ? RS_expr_temp.length["+"](name) : name)] = (RS_expr_temp = RS_str.prototype)[((((typeof name === "number") && name["<"](0))) ? RS_expr_temp.length["+"](name) : name)]; }; }; RS_modules.pythonize.strings = strings; | |
})(); | |
function main(_) { var version, box, sphere, cylinder, pyramid, cone, helix, ellipsoid, ring, arrow, compound, display, vector, print, scene, RS_ls, V, dragging, toDrag, Tom, Dick, s2, strings, __this = this; | |
function handleEvent(event, hit) { | |
var RS_ls; | |
"9"; | |
"10"; | |
RS_interpolate_kwargs.call(this, print, ["handling event!",event," ",].concat([RS_desugar_kwargs({ end: "" }),])); | |
"11"; | |
if (hit) { | |
"12"; | |
print(hit.name); | |
"13"; } | |
else { | |
"14"; | |
print("noHit"); } ; | |
"16"; | |
if ((((event === "mousedown") || ((typeof event === "object") && RS_equals(event, "mousedown"))))) { | |
"17"; | |
dragging = true; | |
"18"; | |
toDrag = hit; | |
"19"; | |
toDrag.emissive = true; } ; | |
"21"; | |
if ((((event === "mouseup") || ((typeof event === "object") && RS_equals(event, "mouseup"))))) { | |
"22"; | |
dragging = false; | |
"23"; | |
toDrag.emissive = false; } ; | |
"25"; | |
if ((((event === "mousemove") || ((typeof event === "object") && RS_equals(event, "mousemove"))))) { | |
"26"; | |
toDrag.pos = scene.mouse.pos; } ; }; function dispatcher(ev) { | |
var RS_ls, hit; | |
"31"; | |
hit = null; | |
"33"; | |
if (RS_in(ev.event, RS_list_decorate(["mousedown","click",]))) { | |
"34"; | |
hit = scene.mouse.pick(); } ; | |
"36"; | |
handleEvent(ev.event, hit); }; var __frame = { name: "main", line: 32 }; return __func(_, this, arguments, main, 0, __frame, function __$main() { version = RS_list_decorate(["2.7","glowscript",]); Array.prototype["+"] = function(r) { return this.concat(r); }; window.__GSlang = "vpython"; box = vp_box; sphere = vp_sphere; cylinder = vp_cylinder; pyramid = vp_pyramid; cone = vp_cone; helix = vp_helix; ellipsoid = vp_ellipsoid; ring = vp_ring; arrow = vp_arrow; compound = vp_compound; display = canvas; vector = vec; print = GSprint; scene = canvas(); strings = RS_modules.pythonize.strings; strings(); "3"; V = vector; "5"; dragging = false; "6"; toDrag = 0; "8"; if (!handleEvent.__argnames__) { Object.defineProperties(handleEvent, { __argnames__: { value: ["event","hit",] } }); } ; "30"; | |
if (!dispatcher.__argnames__) { Object.defineProperties(dispatcher, { | |
__argnames__: { value: ["ev",] } }); } ; | |
"38"; | |
scene.bind("mousedown mousemove mouseup click", dispatcher); | |
"43"; | |
Tom = RS_interpolate_kwargs.call(__this, sphere, [RS_desugar_kwargs({ name: "Tom", color: color.yellow }),]); | |
"44"; | |
Dick = RS_interpolate_kwargs.call(__this, sphere, [RS_desugar_kwargs({ name: "Dick", pos: V(1["-u"](), 1, 0), color: color.blue }),]); | |
"45"; | |
s2 = RS_interpolate_kwargs.call(__this, sphere, [RS_desugar_kwargs({ pos: V(3, 3, 0), color: V(0.5, 0.5, 0.5), opacity: 0.5 }),]); ; });}; | |
if (!main.__argnames__) { Object.defineProperties(main, { | |
__argnames__: { value: ["_",] } });}; | |
;$(function(){ window.__context = { glowscript_container: $("#glowscript").removeAttr("id") }; main(__func) })})() | |
//--><!]]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment