From 3b781edbda7d678df2cc102438f643844d0a27ee Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 9 Aug 2014 23:52:22 -0400 Subject: [PATCH 01/22] Update Ubuntu README.rdoc --- Ubuntu README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ubuntu README.rdoc b/Ubuntu README.rdoc index b468eb4c..e6209f99 100644 --- a/Ubuntu README.rdoc +++ b/Ubuntu README.rdoc @@ -40,7 +40,7 @@ running this will check your system for requirements as well so you will need to alright now we can download metamaps from the master using git -"git clone https://github.com/Connoropolous/metamaps_gen002.git" +"git clone https://github.com/Connoropolous/metamaps_gen002.git[https://github.com/Connoropolous/metamaps_gen002.git]" now there is a couple other things we are going to need which is nodejs, postgresql, libpq-dev and redis-server From bef531fb0706809549cc514b39cd7370c74b8993 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 9 Aug 2014 23:53:13 -0400 Subject: [PATCH 02/22] Update Ubuntu README.rdoc --- Ubuntu README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ubuntu README.rdoc b/Ubuntu README.rdoc index e6209f99..983a7169 100644 --- a/Ubuntu README.rdoc +++ b/Ubuntu README.rdoc @@ -40,7 +40,7 @@ running this will check your system for requirements as well so you will need to alright now we can download metamaps from the master using git -"git clone https://github.com/Connoropolous/metamaps_gen002.git[https://github.com/Connoropolous/metamaps_gen002.git]" +"git clone {https://github.com/Connoropolous/metamaps_gen002.git}[https://github.com/Connoropolous/metamaps_gen002.git]" now there is a couple other things we are going to need which is nodejs, postgresql, libpq-dev and redis-server From 2d70c1b0a6b3800822e22ffc3a1ca65a0a4bb089 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 9 Aug 2014 23:53:55 -0400 Subject: [PATCH 03/22] Update and rename Ubuntu README.rdoc to Ubuntu README.md --- Ubuntu README.rdoc => Ubuntu README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Ubuntu README.rdoc => Ubuntu README.md (95%) diff --git a/Ubuntu README.rdoc b/Ubuntu README.md similarity index 95% rename from Ubuntu README.rdoc rename to Ubuntu README.md index 983a7169..b468eb4c 100644 --- a/Ubuntu README.rdoc +++ b/Ubuntu README.md @@ -40,7 +40,7 @@ running this will check your system for requirements as well so you will need to alright now we can download metamaps from the master using git -"git clone {https://github.com/Connoropolous/metamaps_gen002.git}[https://github.com/Connoropolous/metamaps_gen002.git]" +"git clone https://github.com/Connoropolous/metamaps_gen002.git" now there is a couple other things we are going to need which is nodejs, postgresql, libpq-dev and redis-server From b896770db8682d425643a502861fc2caade2778f Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 00:01:09 -0400 Subject: [PATCH 04/22] Update Ubuntu README.md --- Ubuntu README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ubuntu README.md b/Ubuntu README.md index b468eb4c..8596b0a4 100644 --- a/Ubuntu README.md +++ b/Ubuntu README.md @@ -56,7 +56,7 @@ Install the specific version of ruby needed this will take some time *Note you w "rvm install ruby-1.9.3-p125" -Now we also need to rename your database file which is in ./config/database.default.yml to database.yml +Now we also need to rename your database file which is in ./config/database.yml.default to database.yml now run inside your metamaps_gen002 folder From 01b93fa6f47213e99f65be150b725dc6d3988835 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 00:08:32 -0400 Subject: [PATCH 05/22] Update Ubuntu README.md --- Ubuntu README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ubuntu README.md b/Ubuntu README.md index 8596b0a4..beefc79f 100644 --- a/Ubuntu README.md +++ b/Ubuntu README.md @@ -70,13 +70,13 @@ alright now we need to make sure your postgres password is the same as it is lis Select postgres like this -"\password postgres" +"\password postgres;" set the password to 3112 Then to quit -"\q" +"\q;" now we can run the rake install and db creation From b15da256fa70fcd98a49d04d0d1a8313ec1a8afb Mon Sep 17 00:00:00 2001 From: Robert Best Date: Sat, 16 Aug 2014 12:46:06 -0400 Subject: [PATCH 06/22] Included title box size in zoom to extents and put a limits on the zooming --- Gemfile.lock | 49 ---- .../javascripts/metamaps/Metamaps.JIT.js | 183 ++++++------ db/schema.rb | 266 +++++++++--------- 3 files changed, 216 insertions(+), 282 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a8354dc6..b4efab8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,8 +39,6 @@ GEM rails (~> 3.1) builder (3.0.4) cancan (1.6.10) - childprocess (0.5.3) - ffi (~> 1.0, >= 1.0.11) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.4) @@ -52,7 +50,6 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) - commonwatir (4.0.0) devise (3.2.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -61,8 +58,6 @@ GEM warden (~> 1.2.3) erubis (2.7.0) execjs (2.0.2) - ffi (1.9.0) - ffi (1.9.0-x86-mingw32) formtastic (2.2.1) actionpack (>= 3.0) formula (1.0.1) @@ -80,8 +75,6 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_magick (3.5.0) - subexec (~> 0.2.1) mini_portile (0.6.0) multi_json (1.10.0) nokogiri (1.6.2.1) @@ -96,7 +89,6 @@ GEM mime-types pg (0.17.1) pg (0.17.1-x86-mingw32) - phantomjs (1.9.7.1) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) @@ -123,28 +115,19 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.3.2) - rautomation (0.15.0) - ffi (= 1.9.0) rdoc (3.12.2) json (~> 1.4) redis (2.2.2) - rubyzip (1.1.6) sass (3.3.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.42.0) - childprocess (>= 0.5.0) - multi_json (~> 1.0) - rubyzip (~> 1.0) - websocket (~> 1.0.4) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - subexec (0.2.3) thor (0.19.1) thread_safe (0.3.3) tilt (1.4.1) @@ -157,36 +140,6 @@ GEM json (>= 1.8.0) warden (1.2.3) rack (>= 1.0) - watir (5.0.0) - commonwatir (~> 4) - watir-webdriver - watir (5.0.0-x86-mingw32) - commonwatir (~> 4) - watir-classic (~> 4.0) - watir-webdriver - watir-classic (4.0.1) - ffi (~> 1.0) - multi_json - nokogiri (>= 1.5.7.rc3) - rautomation (~> 0.7) - win32-process (>= 0.5.5) - win32screenshot (~> 1.0.9) - windows-pr (>= 0.6.6) - watir-webdriver (0.6.10) - selenium-webdriver (>= 2.18.0) - websocket (1.0.7) - win32-api (1.5.1-x86-mingw32) - win32-process (0.7.4) - ffi (>= 1.0.0) - win32screenshot (1.0.10) - ffi (~> 1.0) - mini_magick (~> 3.5.0) - rautomation (~> 0.7) - windows-api (0.4.2) - win32-api (>= 1.4.5) - windows-pr (1.2.3) - win32-api (>= 1.4.5) - windows-api (>= 0.4.0) PLATFORMS ruby @@ -205,10 +158,8 @@ DEPENDENCIES json paperclip pg - phantomjs rails (= 3.2.17) rails3-jquery-autocomplete redis (= 2.2.2) sass-rails uglifier (>= 1.0.3) - watir diff --git a/app/assets/javascripts/metamaps/Metamaps.JIT.js b/app/assets/javascripts/metamaps/Metamaps.JIT.js index 7a8c8362..c0250038 100644 --- a/app/assets/javascripts/metamaps/Metamaps.JIT.js +++ b/app/assets/javascripts/metamaps/Metamaps.JIT.js @@ -1461,119 +1461,102 @@ Metamaps.JIT = { if (Metamaps.Selected.Nodes.length > 0) { var nodes = Metamaps.Selected.Nodes; + } + else { + var nodes = _.values(Metamaps.Visualize.mGraph.graph.nodes); + } - if(nodes.length > 1){ - nodes.forEach(function (n) { - var x = n.pos.x, - y = n.pos.y; + if(nodes.length > 1){ + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } + if (counter == 0){ + maxX = x; + minX = x; + maxY = y; + minY = y; + } - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); + var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), + dim = n.getData('dim'), + ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - counter++; - }); + console.log(dim); - var spanX = maxX - minX; - var spanY = maxY - minY; - var ratioX = spanX / width; - var ratioY = spanY / height; + var height = 25 * arrayOfLabelLines.length; - var newRatio = Math.max(ratioX,ratioY); + var index, lineWidths = []; + for (index = 0; index < arrayOfLabelLines.length; ++index) { + lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width) + } + var width = Math.max.apply(null, lineWidths) + 8; - var canvas = Metamaps.Visualize.mGraph.canvas; + maxX = Math.max(x + width /2,maxX); + maxY = Math.max(y + n.getData("height") + 5 + height,maxY); + minX = Math.min(x - width /2,minX); + minY = Math.min(y - dim,minY); - canvas.scale(1/newRatio*0.8,1/newRatio*0.8); + counter++; + }); - counter = 0; + var spanX = maxX - minX; + var spanY = maxY - minY; + var ratioX = spanX / width; + var ratioY = spanY / height; - nodes.forEach(function (n) { - var x = n.pos.x, - y = n.pos.y; + var newRatio = Math.max(ratioX,ratioY); + var scaleMultiplier = 1/newRatio*0.9; - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); + var canvas = Metamaps.Visualize.mGraph.canvas; + if(canvas.scaleOffsetX *scaleMultiplier<= 3 && canvas.scaleOffsetX*scaleMultiplier >= 0.2){ + canvas.scale(scaleMultiplier,scaleMultiplier); } + else if(canvas.scaleOffsetX * scaleMultiplier > 3){ + scaleMultiplier = 3/ canvas.scaleOffsetX; + canvas.scale(scaleMultiplier,scaleMultiplier); + } + else{ + scaleMultiplier = 0.2/ canvas.scaleOffsetX; + canvas.scale(scaleMultiplier,scaleMultiplier); + } + + + counter = 0; + + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; + + if (counter == 0){ + maxX = x; + minX = x; + maxY = y; + minY = y; + } + + var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), + dim = n.getData('dim'), + ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + + console.log(dim); + + var height = 25 * arrayOfLabelLines.length; + + var index, lineWidths = []; + for (index = 0; index < arrayOfLabelLines.length; ++index) { + lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width) + } + var width = Math.max.apply(null, lineWidths) + 8; + + maxX = Math.max(x + width /2,maxX); + maxY = Math.max(y + n.getData("height") + 5 + height,maxY); + minX = Math.min(x - width /2,minX); + minY = Math.min(y - dim,minY); + + counter++; + }); } - else{ - var nodes = Metamaps.Visualize.mGraph.graph; - - if(Object.keys(nodes).length >1){ - nodes.eachNode(function (n) { - var x = n.pos.x, - y = n.pos.y; - - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); - - var spanX = maxX - minX; - var spanY = maxY - minY; - var ratioX = spanX / width; - var ratioY = spanY / height; - - var newRatio = Math.max(ratioX,ratioY); - - var canvas = Metamaps.Visualize.mGraph.canvas; - - canvas.scale(1/newRatio*0.8,1/newRatio*0.8); - - counter = 0; - - nodes.eachNode(function (n) { - var x = n.pos.x, - y = n.pos.y; - - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); - } - } - - - var cogX = (maxX + minX)/2; var cogY = (maxY + minY)/2; diff --git a/db/schema.rb b/db/schema.rb index 4c22e7e5..50334775 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,133 +1,133 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20140815162253) do - - create_table "in_metacode_sets", :force => true do |t| - t.integer "metacode_id" - t.integer "metacode_set_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" - add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" - - create_table "mappings", :force => true do |t| - t.text "category" - t.integer "xloc" - t.integer "yloc" - t.integer "topic_id" - t.integer "synapse_id" - t.integer "map_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "maps", :force => true do |t| - t.text "name" - t.boolean "arranged" - t.text "desc" - t.text "permission" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "featured" - t.string "screenshot_file_name" - t.string "screenshot_content_type" - t.integer "screenshot_file_size" - t.datetime "screenshot_updated_at" - end - - create_table "metacode_sets", :force => true do |t| - t.string "name" - t.text "desc" - t.integer "user_id" - t.boolean "mapperContributed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" - - create_table "metacodes", :force => true do |t| - t.text "name" - t.string "icon" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "synapses", :force => true do |t| - t.text "desc" - t.text "category" - t.text "weight" - t.text "permission" - t.integer "node1_id" - t.integer "node2_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "topics", :force => true do |t| - t.text "name" - t.text "desc" - t.text "link" - t.text "permission" - t.integer "user_id" - t.integer "metacode_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - t.string "audio_file_name" - t.string "audio_content_type" - t.integer "audio_file_size" - t.datetime "audio_updated_at" - end - - create_table "users", :force => true do |t| - t.string "name" - t.string "email" - t.text "settings" - t.string "code", :limit => 8 - t.string "joinedwithcode", :limit => 8 - t.string "crypted_password" - t.string "password_salt" - t.string "persistence_token" - t.string "perishable_token" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "encrypted_password", :limit => 128, :default => "" - t.string "remember_token" - t.datetime "remember_created_at" - t.string "reset_password_token" - t.datetime "last_sign_in_at" - t.string "last_sign_in_ip" - t.integer "sign_in_count", :default => 0 - t.datetime "current_sign_in_at" - t.string "current_sign_in_ip" - t.datetime "reset_password_sent_at" - t.boolean "admin" - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - end - - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20140815162253) do + + create_table "in_metacode_sets", :force => true do |t| + t.integer "metacode_id" + t.integer "metacode_set_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" + add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" + + create_table "mappings", :force => true do |t| + t.text "category" + t.integer "xloc" + t.integer "yloc" + t.integer "topic_id" + t.integer "synapse_id" + t.integer "map_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "maps", :force => true do |t| + t.text "name" + t.boolean "arranged" + t.text "desc" + t.text "permission" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "featured" + t.string "screenshot_file_name" + t.string "screenshot_content_type" + t.integer "screenshot_file_size" + t.datetime "screenshot_updated_at" + end + + create_table "metacode_sets", :force => true do |t| + t.string "name" + t.text "desc" + t.integer "user_id" + t.boolean "mapperContributed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" + + create_table "metacodes", :force => true do |t| + t.text "name" + t.string "icon" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "synapses", :force => true do |t| + t.text "desc" + t.text "category" + t.text "weight" + t.text "permission" + t.integer "node1_id" + t.integer "node2_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "topics", :force => true do |t| + t.text "name" + t.text "desc" + t.text "link" + t.text "permission" + t.integer "user_id" + t.integer "metacode_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + t.string "audio_file_name" + t.string "audio_content_type" + t.integer "audio_file_size" + t.datetime "audio_updated_at" + end + + create_table "users", :force => true do |t| + t.string "name" + t.string "email" + t.text "settings" + t.string "code", :limit => 8 + t.string "joinedwithcode", :limit => 8 + t.string "crypted_password" + t.string "password_salt" + t.string "persistence_token" + t.string "perishable_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "encrypted_password", :limit => 128, :default => "" + t.string "remember_token" + t.datetime "remember_created_at" + t.string "reset_password_token" + t.datetime "last_sign_in_at" + t.string "last_sign_in_ip" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.string "current_sign_in_ip" + t.datetime "reset_password_sent_at" + t.boolean "admin" + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + end + + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + +end From 0160f56238b4ffaf8f69f2ef69e36e22f729a675 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Fri, 26 Sep 2014 22:40:31 -0400 Subject: [PATCH 07/22] partially finished fixes to zoomextents --- app/assets/javascripts/metamaps/JIT.js | 6 ++ .../javascripts/metamaps/Metamaps.GlobalUI.js | 17 ++++ .../javascripts/metamaps/Metamaps.JIT.js | 90 +++++++++++++++---- app/assets/javascripts/metamaps/Metamaps.js | 3 + 4 files changed, 99 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/metamaps/JIT.js b/app/assets/javascripts/metamaps/JIT.js index de6aacb7..c43788bc 100644 --- a/app/assets/javascripts/metamaps/JIT.js +++ b/app/assets/javascripts/metamaps/JIT.js @@ -2489,7 +2489,11 @@ Extras.Classes.Navigation = new Class({ if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) { Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos(); } + Metamaps.Mouse.didPan = false; + + + // END METAMAPS CODE this.pos = eventInfo.getPos(); @@ -2557,6 +2561,8 @@ Extras.Classes.Navigation = new Class({ // START METAMAPS CODE if (Metamaps.Mouse.didPan) Metamaps.JIT.SmoothPanning(); + + // END METAMAPS CODE } diff --git a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js index 13278b28..f1c40b25 100644 --- a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js @@ -372,6 +372,23 @@ Metamaps.GlobalUI.Search = { self.close(0, true); } break; + case 65: + case 97: + e.preventDefault(); + if (e.ctrlKey){ + Metamaps.Visualize.mGraph.graph.eachNode(function (n) { + Metamaps.Control.selectNode(n,e); + }); + + Metamaps.Visualize.mGraph.plot(); + } + + break; + case 69: + case 101: + e.preventDefault(); + Metamaps.JIT.zoomExtents(); + break; default: break; //console.log(e.which); } diff --git a/app/assets/javascripts/metamaps/Metamaps.JIT.js b/app/assets/javascripts/metamaps/Metamaps.JIT.js index c0250038..810f2b2e 100644 --- a/app/assets/javascripts/metamaps/Metamaps.JIT.js +++ b/app/assets/javascripts/metamaps/Metamaps.JIT.js @@ -313,7 +313,7 @@ Metamaps.JIT = { if (Metamaps.Mouse.boxStartCoordinates) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.selectWithBox(e); + Metamaps.JIT.zoomToBox(); return; } @@ -663,8 +663,6 @@ Metamaps.JIT = { var scale = dist / lastDist; - console.log(scale); - if (8 >= Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale && Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale >= 1) { Metamaps.Visualize.mGraph.canvas.scale(scale, scale); } @@ -945,7 +943,9 @@ Metamaps.JIT = { var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y; var toNodeX = synapse.get('edge').nodeTo.pos.x; var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y; - + var from = synapse.get('edge').nodeFrom; + var to = synapse.get('edge').nodeTo; + var maxX = fromNodeX; var maxY = fromNodeY; var minX = fromNodeX; @@ -964,7 +964,7 @@ Metamaps.JIT = { (eX > maxBoxX) ? (maxBoxX = eX):(minBoxX = eX); (eY > maxBoxY) ? (maxBoxY = eY):(minBoxY = eY); - //Fins the slopes from the synapse fromNode to the 4 corners of the selection box + //Find the slopes from the synapse fromNode to the 4 corners of the selection box var slopes = []; slopes.push( (sY - fromNodeY) / (sX - fromNodeX) ); slopes.push( (sY - fromNodeY) / (eX - fromNodeX) ); @@ -983,6 +983,10 @@ Metamaps.JIT = { var b = fromNodeY - synSlope * fromNodeX; var selectTest = false; + if (from.name == 'node 3' && to.name == 'node1'){ + console.log(from.pos.x,-1*from.pos.y,to.pos.x,-1*to.pos.y,sX,sY,eX,eY); + } + //if the synapse slope is within a range that would intersect with the selection box if (synSlope <= maxSlope && synSlope >= minSlope){ @@ -1003,17 +1007,18 @@ Metamaps.JIT = { testY = sY; testX = (testY - b)/synSlope; - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){ + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ selectTest = true; } testY = eY; testX = (testY - b)/synSlope; - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){ + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ selectTest = true; } } + //console.log('From '+from.name + ' to ' + to.name + ' is a ' +selectTest); //The test synapse was selected! if(selectTest){ if(e.ctrlKey){ @@ -1078,15 +1083,23 @@ Metamaps.JIT = { // wait a certain length of time, then check again, then run this code setTimeout(function () { if (!Metamaps.JIT.nodeWasDoubleClicked()) { - if (!e.shiftKey) { + if (!e.shiftKey && !e.ctrlKey) { Metamaps.Control.deselectAllNodes(); Metamaps.Control.deselectAllEdges(); } - if (node.selected) { - Metamaps.Control.deselectNode(node); - } else { + if(e.ctrlKey || e.shiftKey){ + if (node.selected) { + Metamaps.Control.deselectNode(node); + } else { + Metamaps.Control.selectNode(node,e); + } + } + else{ + Metamaps.Control.deselectAllNodes(); + Metamaps.Control.deselectAllEdges(); Metamaps.Control.selectNode(node,e); } + //trigger animation to final styles Metamaps.Visualize.mGraph.fx.animate({ modes: ['edge-property:lineWidth:color:alpha'], @@ -1111,7 +1124,6 @@ Metamaps.JIT = { // create new menu for clicked on node var rightclickmenu = document.createElement("div"); rightclickmenu.className = "rightclickmenu"; - // add the proper options to the menu var menustring = '
    '; @@ -1139,7 +1151,7 @@ Metamaps.JIT = { top: e.clientY }); //add the menu to the page - $('#center-container').append(rightclickmenu); + $('#infovis-canvaswidget').append(rightclickmenu); // attach events to clicks on the list items @@ -1452,6 +1464,54 @@ Metamaps.JIT = { canvas.translate(-1*offsetX,-1*offsetY); }, + zoomToBox: function () { + var sX = Metamaps.Mouse.boxStartCoordinates.x, + sY = Metamaps.Mouse.boxStartCoordinates.y, + eX = Metamaps.Mouse.boxEndCoordinates.x, + eY = Metamaps.Mouse.boxEndCoordinates.y; + + Metamaps.JIT.centerMap(); + + var height = $(document).height(), + width = $(document).width(); + + var spanX = Math.abs(sX - eX); + var spanY = Math.abs(sY - eY); + var ratioX = width / spanX; + var ratioY = height / spanY; + console.log(ratioX,ratioY); + + var newRatio = Math.min(ratioX,ratioY); + + var canvas = Metamaps.Visualize.mGraph.canvas; + + if(canvas.scaleOffsetX *newRatio<= 5 && canvas.scaleOffsetX*newRatio >= 0.2){ + canvas.scale(newRatio,newRatio); + } + else if(canvas.scaleOffsetX * newRatio > 5){ + newRatio = 5/ canvas.scaleOffsetX; + canvas.scale(newRatio,newRatio); + } + else{ + newRatio = 0.2/ canvas.scaleOffsetX; + canvas.scale(newRatio,newRatio); + } + + + + + + var cogX = (sX + eX)/2; + var cogY = (sY + eY)/2; + + canvas.translate(-1* cogX, -1* cogY); + + + Metamaps.Mouse.boxStartCoordinates = false; + Metamaps.Mouse.boxEndCoordinates = false; + Metamaps.Visualize.mGraph.plot(); + + }, zoomExtents: function () { Metamaps.JIT.centerMap(); var height = $(document).height(), @@ -1482,8 +1542,6 @@ Metamaps.JIT = { dim = n.getData('dim'), ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - console.log(dim); - var height = 25 * arrayOfLabelLines.length; var index, lineWidths = []; @@ -1539,8 +1597,6 @@ Metamaps.JIT = { dim = n.getData('dim'), ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - console.log(dim); - var height = 25 * arrayOfLabelLines.length; var index, lineWidths = []; diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index c7b6e3e6..6f4473f9 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -47,6 +47,7 @@ Metamaps.Touch = { Metamaps.Mouse = { didPan: false, + didBoxZoom: false, changeInX: 0, changeInY: 0, edgeHoveringOver: false, @@ -1718,11 +1719,13 @@ Metamaps.Control = { if (Metamaps.Selected.Nodes.indexOf(node) != -1) return; node.selected = true; node.setData('dim', 30, 'current'); + /* if(!(e.ctrlKey) && !(e.altKey)){ node.eachAdjacency(function (adj) { Metamaps.Control.selectEdge(adj); }); } + */ Metamaps.Selected.Nodes.push(node); }, From 2de7167c2c71ff3219ea28c2a8d3834ccff35536 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Sun, 28 Sep 2014 15:29:22 -0400 Subject: [PATCH 08/22] A bunch of fixes for selection with box, and zoom to extents --- .../javascripts/src/Metamaps.GlobalUI.js | 12 +- app/assets/javascripts/src/Metamaps.JIT.js | 114 +++++++++--------- 2 files changed, 66 insertions(+), 60 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js b/app/assets/javascripts/src/Metamaps.GlobalUI.js index 4c2d9a05..a425d78f 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js @@ -368,8 +368,12 @@ Metamaps.GlobalUI.Search = { break; case 65: case 97: - e.preventDefault(); + if (e.ctrlKey){ + Metamaps.Control.deselectAllNodes(); + Metamaps.Control.deselectAllEdges(); + + e.preventDefault(); Metamaps.Visualize.mGraph.graph.eachNode(function (n) { Metamaps.Control.selectNode(n,e); }); @@ -380,8 +384,10 @@ Metamaps.GlobalUI.Search = { break; case 69: case 101: - e.preventDefault(); - Metamaps.JIT.zoomExtents(); + if (e.ctrlKey){ + e.preventDefault(); + Metamaps.JIT.zoomExtents(); + } break; default: break; //console.log(e.which); diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 9562e2fd..41481c56 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -938,7 +938,7 @@ Metamaps.JIT = { Metamaps.Control.deselectAllEdges(); } - //select all nodes, and their edges, that are within the box + //select all nodes that are within the box Metamaps.Visualize.mGraph.graph.eachNode(function (n) { var x = n.pos.x, y = n.pos.y; @@ -967,10 +967,8 @@ Metamaps.JIT = { var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y; var toNodeX = synapse.get('edge').nodeTo.pos.x; var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y; - var from = synapse.get('edge').nodeFrom; - var to = synapse.get('edge').nodeTo; - - var maxX = fromNodeX; + + var maxX = fromNodeX; var maxY = fromNodeY; var minX = fromNodeX; var minY = fromNodeY; @@ -1005,45 +1003,44 @@ Metamaps.JIT = { //Find synapse-in-question's slope var synSlope = (toNodeY - fromNodeY) / (toNodeX - fromNodeX); var b = fromNodeY - synSlope * fromNodeX; + + //Use the selection box edges as test cases for synapse intersection + var testX = sX; + var testY = synSlope * testX + b; + + var selectTest; - var selectTest = false; - if (from.name == 'node 3' && to.name == 'node1'){ - console.log(from.pos.x,-1*from.pos.y,to.pos.x,-1*to.pos.y,sX,sY,eX,eY); - } - - - //if the synapse slope is within a range that would intersect with the selection box - if (synSlope <= maxSlope && synSlope >= minSlope){ - var testX = sX; - var testY = synSlope * testX + b; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ - selectTest = true; - } - - testX = eX; - testY = synSlope * testX + b; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ - selectTest = true; - } - - testY = sY; - testX = (testY - b)/synSlope; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ - selectTest = true; - } - - testY = eY; - testX = (testY - b)/synSlope; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ - selectTest = true; - } + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ + selectTest = true; } - //console.log('From '+from.name + ' to ' + to.name + ' is a ' +selectTest); - //The test synapse was selected! + + testX = eX; + testY = synSlope * testX + b; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ + selectTest = true; + } + + testY = sY; + testX = (testY - b)/synSlope; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ + selectTest = true; + } + + testY = eY; + testX = (testY - b)/synSlope; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ + selectTest = true; + } + + //Case where the synapse is wholly enclosed in the seldction box + if(fromNodeX >= minBoxX && fromNodeX <= maxBoxX && fromNodeY >= minBoxY && fromNodeY <= maxBoxY && toNodeX >= minBoxX && toNodeX <= maxBoxX && toNodeY >= minBoxY && toNodeY <= maxBoxY){ + selectTest = true; + } + + //The test synapse was selected! if(selectTest){ if(e.ctrlKey){ if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){ @@ -1520,7 +1517,6 @@ Metamaps.JIT = { var spanY = Math.abs(sY - eY); var ratioX = width / spanX; var ratioY = height / spanY; - console.log(ratioX,ratioY); var newRatio = Math.min(ratioX,ratioY); @@ -1536,11 +1532,7 @@ Metamaps.JIT = { else{ newRatio = 0.2/ canvas.scaleOffsetX; canvas.scale(newRatio,newRatio); - } - - - - + } var cogX = (sX + eX)/2; var cogY = (sY + eY)/2; @@ -1558,6 +1550,7 @@ Metamaps.JIT = { var height = $(document).height(), width = $(document).width(), maxX, minX, maxY, minY, counter = 0; + var canvas = Metamaps.Visualize.mGraph.canvas; if (Metamaps.Selected.Nodes.length > 0) { @@ -1581,7 +1574,7 @@ Metamaps.JIT = { var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), dim = n.getData('dim'), - ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + ctx = canvas.getCtx(); var height = 25 * arrayOfLabelLines.length; @@ -1607,7 +1600,6 @@ Metamaps.JIT = { var newRatio = Math.max(ratioX,ratioY); var scaleMultiplier = 1/newRatio*0.9; - var canvas = Metamaps.Visualize.mGraph.canvas; if(canvas.scaleOffsetX *scaleMultiplier<= 3 && canvas.scaleOffsetX*scaleMultiplier >= 0.2){ canvas.scale(scaleMultiplier,scaleMultiplier); } @@ -1620,7 +1612,6 @@ Metamaps.JIT = { canvas.scale(scaleMultiplier,scaleMultiplier); } - counter = 0; nodes.forEach(function (n) { @@ -1636,7 +1627,7 @@ Metamaps.JIT = { var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), dim = n.getData('dim'), - ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + ctx = canvas.getCtx(); var height = 25 * arrayOfLabelLines.length; @@ -1653,12 +1644,21 @@ Metamaps.JIT = { counter++; }); + + var cogX = (maxX + minX)/2; + var cogY = (maxY + minY)/2; + + canvas.translate(-1* cogX, -1* cogY); + $(document).trigger(Metamaps.JIT.events.zoom, [event]); } + else if(nodes.length == 1){ + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; - var cogX = (maxX + minX)/2; - var cogY = (maxY + minY)/2; - - canvas.translate(-1* cogX, -1* cogY); - $(document).trigger(Metamaps.JIT.events.zoom, [event]); + canvas.translate(-1* x, -1* y); + $(document).trigger(Metamaps.JIT.events.zoom, [event]); + }); + } } }; \ No newline at end of file From 2b16123a4f5b62db1a922b0692727f2eb58299b6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 10:45:08 -0400 Subject: [PATCH 09/22] fixed field type error on user edit form --- app/views/users/edit.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 82166dbf..069a28a4 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -15,8 +15,10 @@
    <%= @user.name %>
    -
    <%= form.label :name, "Name:", :class => "firstFieldText" %> - <%= form.email_field :name %>
    +
    + <%= form.label :name, "Name:", :class => "firstFieldText" %> + <%= form.text_field :name %> +
    <%= form.label :email, "Email:", :class => "firstFieldText" %> <%= form.email_field :email %>
    Change Password
    From 06f18215dd3484049845518366cc46c494791251 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:04:36 -0400 Subject: [PATCH 10/22] bug fixes for mapping experience. able to store multiple references to synapses on each edge --- app/assets/javascripts/src/JIT.js | 3 +- app/assets/javascripts/src/Metamaps.JIT.js | 40 ++++++--- app/assets/javascripts/src/Metamaps.Router.js | 1 + app/assets/javascripts/src/Metamaps.js | 83 +++++++++++++------ app/assets/stylesheets/application.css | 2 +- app/assets/stylesheets/clean.css | 8 ++ 6 files changed, 95 insertions(+), 42 deletions(-) diff --git a/app/assets/javascripts/src/JIT.js b/app/assets/javascripts/src/JIT.js index 1cc4b8e1..bc3f23c3 100644 --- a/app/assets/javascripts/src/JIT.js +++ b/app/assets/javascripts/src/JIT.js @@ -7081,7 +7081,8 @@ Graph.Plot = { var l = Metamaps.Mouse.synapseStartCoordinates.length; for (var i = l - 1; i >= 0; i -= 1) { start = Metamaps.Mouse.synapseStartCoordinates[i]; - Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.5, true); + Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.3, true); + Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.7, true); } ctx.restore(); } diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 41481c56..3c5b79c9 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -20,6 +20,7 @@ Metamaps.JIT = { */ prepareVizData: function () { var self = Metamaps.JIT; + var synapsesToRemove = []; var topic; var mapping; var node; @@ -39,7 +40,12 @@ Metamaps.JIT = { Metamaps.Synapses.each(function (s) { edge = s.createEdge(); - if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) { + if(Metamaps.Topics.get(s.get('node1_id')) === undefined || Metamaps.Topics.get(s.get('node2_id')) === undefined) { + // this means it's an invalid synapse + synapsesToRemove.push(s); + } + else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) { + existingEdge = _.findWhere(edges, { nodeFrom: edge.nodeFrom, nodeTo: edge.nodeTo @@ -53,15 +59,24 @@ Metamaps.JIT = { // for when you're dealing with multiple relationships between the same two topics if (Metamaps.Active.Map) { mapping = s.getMapping(); - existingEdge['$mappingIDs'].push(mapping.isNew() ? mapping.cid : mapping.id); + existingEdge.data['$mappingIDs'].push(mapping.id); } - existingEdge['$synapseIDs'].push(s.id); + existingEdge.data['$synapseIDs'].push(s.id); } else { // for when you're dealing with a topic that has relationships to many different nodes nodes[edge.nodeFrom].adjacencies.push(edge); + edges.push(edge); } } }); + + // clean up the synapses array in case of any faulty data + _.each(synapsesToRemove, function (synapse) { + mapping = synapse.getMapping(); + Metamaps.Synapses.remove(synapse); + Metamaps.Mappings.remove(mapping); + }); + _.each(nodes, function (node) { self.vizData.push(node); }); @@ -319,7 +334,7 @@ Metamaps.JIT = { if (Metamaps.Mouse.boxStartCoordinates) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.zoomToBox(); + Metamaps.JIT.zoomToBox(e); return; } @@ -816,8 +831,8 @@ Metamaps.JIT = { } else if (tempInit && tempNode2 != null) { // this means you want to create a synapse between two existing topics Metamaps.Create.newTopic.addSynapse = false; - Metamaps.Create.newSynapse.topic1id = tempNode.id; - Metamaps.Create.newSynapse.topic2id = tempNode2.id; + Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id; + Metamaps.Create.newSynapse.topic2id = tempNode2.getData('topic').id; tempNode2.setData('dim', 25, 'current'); Metamaps.Visualize.mGraph.plot(); midpoint.x = tempNode.pos.getc().x + (tempNode2.pos.getc().x - tempNode.pos.getc().x) / 2; @@ -1414,9 +1429,9 @@ Metamaps.JIT = { var v2 = intermediatePoint.$add(normal.$scale(-1)); if (newSynapse) { - ctx.strokeStyle = "#222222"; + ctx.strokeStyle = "#4fc059"; ctx.lineWidth = 2; - ctx.globalAlpha = 0.4; + ctx.globalAlpha = 1; } ctx.beginPath(); ctx.moveTo(from.x, from.y); @@ -1465,8 +1480,7 @@ Metamaps.JIT = { y: posChild.y }, 13, false, canvas, 0.7); } else if (directionCat == "from-to") { - var direction = adj.data.$direction; - var inv = (direction && direction.length > 1 && direction[0] != adj.nodeFrom.id); + var inv = (direction[0] != adj.nodeFrom.id); self.renderMidArrow({ x: pos.x, y: pos.y @@ -1502,7 +1516,7 @@ Metamaps.JIT = { canvas.translate(-1*offsetX,-1*offsetY); }, - zoomToBox: function () { + zoomToBox: function (event) { var sX = Metamaps.Mouse.boxStartCoordinates.x, sY = Metamaps.Mouse.boxStartCoordinates.y, eX = Metamaps.Mouse.boxEndCoordinates.x, @@ -1538,14 +1552,14 @@ Metamaps.JIT = { var cogY = (sY + eY)/2; canvas.translate(-1* cogX, -1* cogY); - + $(document).trigger(Metamaps.JIT.events.zoom, [event]); Metamaps.Mouse.boxStartCoordinates = false; Metamaps.Mouse.boxEndCoordinates = false; Metamaps.Visualize.mGraph.plot(); }, - zoomExtents: function () { + zoomExtents: function (event) { Metamaps.JIT.centerMap(); var height = $(document).height(), width = $(document).width(), diff --git a/app/assets/javascripts/src/Metamaps.Router.js b/app/assets/javascripts/src/Metamaps.Router.js index dadc3771..b8df146a 100644 --- a/app/assets/javascripts/src/Metamaps.Router.js +++ b/app/assets/javascripts/src/Metamaps.Router.js @@ -130,6 +130,7 @@ Metamaps.GlobalUI.Search.unlock(); Metamaps.GlobalUI.Search.close(0, true); + Metamaps.Loading.show(); Metamaps.Map.end(); Metamaps.Map.launch(id); }, diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index ba648acf..83ece7d7 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -217,15 +217,15 @@ Metamaps.Backbone.init = function () { else return false; }, getTopic1: function () { - return Metamaps.Topic.get(this.get('node1_id')); + return Metamaps.Topics.get(this.get('node1_id')); }, getTopic2: function () { - return Metamaps.Topic.get(this.get('node2_id')); + return Metamaps.Topics.get(this.get('node2_id')); }, getDirection: function () { return [ - this.get('node1_id'), - this.get('node2_id') + this.getTopic1().get('node').id, + this.getTopic2().get('node').id ]; }, getMapping: function () { @@ -1232,11 +1232,15 @@ Metamaps.Visualize = { topic.updateNode(); n.eachAdjacency(function (edge) { - l = edge.getData('synapseIDs').length; - for (i = 0; i < l; i++) { - synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); - synapse.set('edge', edge); - synapse.updateEdge(); + if(!edge.getData('init')) { + edge.setData('init', true); + + l = edge.getData('synapseIDs').length; + for (i = 0; i < l; i++) { + synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); + synapse.set('edge', edge); + synapse.updateEdge(); + } } }); @@ -1254,11 +1258,15 @@ Metamaps.Visualize = { mapping = topic.getMapping(); n.eachAdjacency(function (edge) { - l = edge.getData('synapseIDs').length; - for (i = 0; i < l; i++) { - synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); - synapse.set('edge', edge); - synapse.updateEdge(); + if(!edge.getData('init')) { + edge.setData('init', true); + + l = edge.getData('synapseIDs').length; + for (i = 0; i < l; i++) { + synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); + synapse.set('edge', edge); + synapse.updateEdge(); + } } }); @@ -1274,7 +1282,6 @@ Metamaps.Visualize = { /** * render does the heavy lifting of creating the engine that renders the graph with the properties we desire * - * @param vizData a json structure containing the data to be rendered. */ render: function () { var self = Metamaps.Visualize, RGraphSettings, FDSettings; @@ -2902,6 +2909,8 @@ Metamaps.Topic = { var newnode = topic.createNode(); + var midpoint = {}, pixelPos; + if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) { Metamaps.Visualize.mGraph.graph.addNode(newnode); Metamaps.Visualize.mGraph.graph.eachNode(function (n) { @@ -2927,8 +2936,15 @@ Metamaps.Topic = { nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "end"); } if (Metamaps.Create.newTopic.addSynapse) { - Metamaps.Create.newSynapse.topic1id = tempNode.id; - Metamaps.Create.newSynapse.topic2id = nodeOnViz.id; + Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id; + + // position the form + midpoint.x = tempNode.pos.getc().x + (nodeOnViz.pos.getc().x - tempNode.pos.getc().x) / 2; + midpoint.y = tempNode.pos.getc().y + (nodeOnViz.pos.getc().y - tempNode.pos.getc().y) / 2; + pixelPos = Metamaps.Util.coordsToPixels(midpoint); + $('#new_synapse').css('left', pixelPos.x + "px"); + $('#new_synapse').css('top', pixelPos.y + "px"); + // show the form Metamaps.Create.newSynapse.open(); Metamaps.Visualize.mGraph.fx.animate({ modes: ["node-property:dim"], @@ -2970,14 +2986,21 @@ Metamaps.Topic = { }); } + + var successCallback = function (topicModel, response) { + if (Metamaps.Active.Map) { + mapping.save({ topic_id: topicModel.id }); + } + + if (Metamaps.Create.newTopic.addSynapse) { + Metamaps.Create.newSynapse.topic2id = topicModel.id; + } + }; + if (!Metamaps.Settings.sandbox && createNewInDB) { if (topic.isNew()) { topic.save(null, { - success: function (topicModel, response) { - if (Metamaps.Active.Map) { - mapping.save({ topic_id: topicModel.id }); - } - }, + success: successCallback, error: function (model, response) { console.log('error saving topic to database'); } @@ -3116,12 +3139,13 @@ Metamaps.Synapse = { //for each node in this array we will create a synapse going to the position2 node. var synapsesToCreate = []; - node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id); - topic2 = node2.getData('topic'); + topic2 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id); + node2 = topic2.get('node'); var len = Metamaps.Selected.Nodes.length; if (len == 0) { - synapsesToCreate[0] = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id); + synapsesToCreate[0] = topic1.get('node'); } else if (len > 0) { synapsesToCreate = Metamaps.Selected.Nodes; } @@ -3150,6 +3174,8 @@ Metamaps.Synapse = { }, getSynapseFromAutocomplete: function (id) { var self = Metamaps.Synapse, + topic1, + topic2, node1, node2; @@ -3161,8 +3187,10 @@ Metamaps.Synapse = { }); Metamaps.Mappings.add(mapping); - node1 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id); - node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id); + node1 = topic1.get('node'); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id); + node2 = topic2.get('node'); Metamaps.Create.newSynapse.hide(); self.renderSynapse(mapping, synapse, node1, node2, true); @@ -3220,6 +3248,7 @@ Metamaps.Map = { Metamaps.Filter.checkMappers(); Metamaps.Realtime.startActiveMap(); + Metamaps.Loading.hide(); } $.ajax({ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 8ae9967a..cebb5434 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -862,7 +862,7 @@ label[for="user_remember_me"] { .sidebarFilterBox { display:none; - width: 304px; + width: 319px; padding: 16px 0; overflow-y: auto; } diff --git a/app/assets/stylesheets/clean.css b/app/assets/stylesheets/clean.css index 918af0c3..06f7ea90 100644 --- a/app/assets/stylesheets/clean.css +++ b/app/assets/stylesheets/clean.css @@ -606,6 +606,14 @@ background-color: #9150bc; } +.github-fork-ribbon-wrapper { + display:none; +} + +.homePage .github-fork-ribbon-wrapper { + display: block; +} + /* end home page */ /* infoAndHelp */ From 2d2f98373efbc0709b8a54c9df22c5c0c42112c7 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:41:16 -0400 Subject: [PATCH 11/22] fixed error in _filterBox that was causing maps not to load when a synapse had a nil description --- app/views/shared/_filterBox.html.erb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/shared/_filterBox.html.erb b/app/views/shared/_filterBox.html.erb index 4ba9b91a..9f9f2cb7 100644 --- a/app/views/shared/_filterBox.html.erb +++ b/app/views/shared/_filterBox.html.erb @@ -33,9 +33,21 @@ end end - @metacodes.sort! {|x,y| x.name <=> y.name } - @synapses.sort! {|x,y| x.desc <=> y.desc } - @mappers.sort! {|x,y| x.name <=> y.name } + @metacodes.sort! {|x,y| + n1 = x.name || "" + n2 = y.name || "" + n1 <=> n2 + } + @synapses.sort! {|x,y| + d1 = x.desc || "" + d2 = y.desc || "" + d1 <=> d2 + } + @mappers.sort! {|x,y| + n1 = x.name || "" + n2 = y.name || "" + n1 <=> n2 + } @metacodes.each_with_index do |metacode, index| @metacodelist += '
  • ' From f9a24058aa4afc6a9575ab29f428f82584fc3f01 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:45:59 -0400 Subject: [PATCH 12/22] fixed error in _filterBox that was causing maps not to load when a synapse had a nil description --- app/views/shared/_filterBox.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/shared/_filterBox.html.erb b/app/views/shared/_filterBox.html.erb index 9f9f2cb7..9f6adeb4 100644 --- a/app/views/shared/_filterBox.html.erb +++ b/app/views/shared/_filterBox.html.erb @@ -55,7 +55,8 @@ @metacodelist += '

    ' + metacode.name.downcase + '

  • ' end @synapses.each_with_index do |synapse, index| - @synapselist += '
  • ' + d = synapse.desc || "" + @synapselist += '
  • ' @synapselist += 'synapse icon

    ' + synapse.desc @synapselist += '

  • ' end From f14bdfac577e9aa843c6882cd265decf30b24158 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:50:41 -0400 Subject: [PATCH 13/22] fixed error in _filterBox that was causing maps not to load when a synapse had a nil description. for real this time --- app/views/shared/_filterBox.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_filterBox.html.erb b/app/views/shared/_filterBox.html.erb index 9f6adeb4..e3a633c1 100644 --- a/app/views/shared/_filterBox.html.erb +++ b/app/views/shared/_filterBox.html.erb @@ -57,7 +57,7 @@ @synapses.each_with_index do |synapse, index| d = synapse.desc || "" @synapselist += '
  • ' - @synapselist += 'synapse icon

    ' + synapse.desc + @synapselist += 'synapse icon

    ' + d @synapselist += '

  • ' end @mappers.each_with_index do |mapper, index| From 2138aa89f393ee6879bb096f0e8828baa626a04f Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 22:26:12 -0400 Subject: [PATCH 14/22] closes #368. ability to add in metacode colors --- app/assets/stylesheets/application.css | 3 + app/assets/stylesheets/base.css | 2 +- app/views/layouts/application.html.erb | 1 + app/views/metacodes/_form.html.erb | 5 + app/views/metacodes/index.html.erb | 8 + app/views/shared/_metacodeBgColors.html.erb | 9 + .../20140930013020_add_color_to_metacodes.rb | 5 + .../20140930013020_add_color_to_metacodes.rb~ | 5 + db/schema.rb | 267 +++++++++--------- metacode_backgrounds.css | 120 ++++++++ 10 files changed, 291 insertions(+), 134 deletions(-) create mode 100644 app/views/shared/_metacodeBgColors.html.erb create mode 100644 db/migrate/20140930013020_add_color_to_metacodes.rb create mode 100644 db/migrate/20140930013020_add_color_to_metacodes.rb~ create mode 100644 metacode_backgrounds.css diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index cebb5434..5bd28000 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2151,6 +2151,9 @@ float: left; .blackBox td.iconURL { max-width: 415px; word-wrap: break-word; +} +.blackBox td.iconColor { + } .blackBox .field { margin: 15px 0 5px; diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css index cfa49d44..3725297e 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css @@ -292,7 +292,7 @@ cursor: pointer; display: none; width: 90%; padding: 13px 0 9px 10%; - background-color: #64BC61; + background-color: #E0E0E0; color: #424242; } .permission.canEdit .metacodeTitle { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9e17a43d..91e9693b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -77,6 +77,7 @@ <%= render :partial => 'layouts/lightboxes' %> <%= render :partial => 'layouts/templates' %> +<%= render :partial => 'shared/metacodeBgColors' %> diff --git a/app/views/metacodes/_form.html.erb b/app/views/metacodes/_form.html.erb index de815bbc..ee19048b 100644 --- a/app/views/metacodes/_form.html.erb +++ b/app/views/metacodes/_form.html.erb @@ -21,6 +21,11 @@ <%= f.text_field :icon %>
    +
    + <%= f.label :color, "Color (hex with # sign)" %> + <%= f.text_field :color %> +
    +
    <%= link_to 'Cancel', metacodes_path, { :class => 'button', 'data-bypass' => 'true' } %> <%= f.submit :class => 'add' %> diff --git a/app/views/metacodes/index.html.erb b/app/views/metacodes/index.html.erb index 36901d56..c99634d4 100644 --- a/app/views/metacodes/index.html.erb +++ b/app/views/metacodes/index.html.erb @@ -6,6 +6,7 @@ Name Icon + Color @@ -14,6 +15,13 @@ <%= metacode.name %> <%= metacode.icon %> + <% if metacode.color %> + + <%= metacode.color %> + + <% else %> + + <% end %> <%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %> diff --git a/app/views/shared/_metacodeBgColors.html.erb b/app/views/shared/_metacodeBgColors.html.erb new file mode 100644 index 00000000..a1aa030c --- /dev/null +++ b/app/views/shared/_metacodeBgColors.html.erb @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/db/migrate/20140930013020_add_color_to_metacodes.rb b/db/migrate/20140930013020_add_color_to_metacodes.rb new file mode 100644 index 00000000..59c8f89f --- /dev/null +++ b/db/migrate/20140930013020_add_color_to_metacodes.rb @@ -0,0 +1,5 @@ +class AddColorToMetacodes < ActiveRecord::Migration + def change + add_column :metacodes, :color, :string + end +end diff --git a/db/migrate/20140930013020_add_color_to_metacodes.rb~ b/db/migrate/20140930013020_add_color_to_metacodes.rb~ new file mode 100644 index 00000000..59c8f89f --- /dev/null +++ b/db/migrate/20140930013020_add_color_to_metacodes.rb~ @@ -0,0 +1,5 @@ +class AddColorToMetacodes < ActiveRecord::Migration + def change + add_column :metacodes, :color, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 50334775..113dba8a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,133 +1,134 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20140815162253) do - - create_table "in_metacode_sets", :force => true do |t| - t.integer "metacode_id" - t.integer "metacode_set_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" - add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" - - create_table "mappings", :force => true do |t| - t.text "category" - t.integer "xloc" - t.integer "yloc" - t.integer "topic_id" - t.integer "synapse_id" - t.integer "map_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "maps", :force => true do |t| - t.text "name" - t.boolean "arranged" - t.text "desc" - t.text "permission" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "featured" - t.string "screenshot_file_name" - t.string "screenshot_content_type" - t.integer "screenshot_file_size" - t.datetime "screenshot_updated_at" - end - - create_table "metacode_sets", :force => true do |t| - t.string "name" - t.text "desc" - t.integer "user_id" - t.boolean "mapperContributed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" - - create_table "metacodes", :force => true do |t| - t.text "name" - t.string "icon" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "synapses", :force => true do |t| - t.text "desc" - t.text "category" - t.text "weight" - t.text "permission" - t.integer "node1_id" - t.integer "node2_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "topics", :force => true do |t| - t.text "name" - t.text "desc" - t.text "link" - t.text "permission" - t.integer "user_id" - t.integer "metacode_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - t.string "audio_file_name" - t.string "audio_content_type" - t.integer "audio_file_size" - t.datetime "audio_updated_at" - end - - create_table "users", :force => true do |t| - t.string "name" - t.string "email" - t.text "settings" - t.string "code", :limit => 8 - t.string "joinedwithcode", :limit => 8 - t.string "crypted_password" - t.string "password_salt" - t.string "persistence_token" - t.string "perishable_token" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "encrypted_password", :limit => 128, :default => "" - t.string "remember_token" - t.datetime "remember_created_at" - t.string "reset_password_token" - t.datetime "last_sign_in_at" - t.string "last_sign_in_ip" - t.integer "sign_in_count", :default => 0 - t.datetime "current_sign_in_at" - t.string "current_sign_in_ip" - t.datetime "reset_password_sent_at" - t.boolean "admin" - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - end - - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20140930013020) do + + create_table "in_metacode_sets", :force => true do |t| + t.integer "metacode_id" + t.integer "metacode_set_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" + add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" + + create_table "mappings", :force => true do |t| + t.text "category" + t.integer "xloc" + t.integer "yloc" + t.integer "topic_id" + t.integer "synapse_id" + t.integer "map_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "maps", :force => true do |t| + t.text "name" + t.boolean "arranged" + t.text "desc" + t.text "permission" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "featured" + t.string "screenshot_file_name" + t.string "screenshot_content_type" + t.integer "screenshot_file_size" + t.datetime "screenshot_updated_at" + end + + create_table "metacode_sets", :force => true do |t| + t.string "name" + t.text "desc" + t.integer "user_id" + t.boolean "mapperContributed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" + + create_table "metacodes", :force => true do |t| + t.text "name" + t.string "icon" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "color" + end + + create_table "synapses", :force => true do |t| + t.text "desc" + t.text "category" + t.text "weight" + t.text "permission" + t.integer "node1_id" + t.integer "node2_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "topics", :force => true do |t| + t.text "name" + t.text "desc" + t.text "link" + t.text "permission" + t.integer "user_id" + t.integer "metacode_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + t.string "audio_file_name" + t.string "audio_content_type" + t.integer "audio_file_size" + t.datetime "audio_updated_at" + end + + create_table "users", :force => true do |t| + t.string "name" + t.string "email" + t.text "settings" + t.string "code", :limit => 8 + t.string "joinedwithcode", :limit => 8 + t.string "crypted_password" + t.string "password_salt" + t.string "persistence_token" + t.string "perishable_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "encrypted_password", :limit => 128, :default => "" + t.string "remember_token" + t.datetime "remember_created_at" + t.string "reset_password_token" + t.datetime "last_sign_in_at" + t.string "last_sign_in_ip" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.string "current_sign_in_ip" + t.datetime "reset_password_sent_at" + t.boolean "admin" + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + end + + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + +end diff --git a/metacode_backgrounds.css b/metacode_backgrounds.css new file mode 100644 index 00000000..adf69d4e --- /dev/null +++ b/metacode_backgrounds.css @@ -0,0 +1,120 @@ +.mbgAction { + background-color: #bd6c85 !important; +} +.mbgActivity { + background-color: #6ebf65 !important; +} +.mbgArgument { + background-color: #7FAEFD !important; +} +.mbgBizarre { + background-color: #bdb25e !important; +} +.mbgCatalyst { + background-color: #EF8964 !important; +} +.mbgClosed { + background-color: #ABB49F !important; +} +.mbgCon { + background-color: #CF7C74 !important; +} +.mbgDecision { + background-color: #cca866 !important; +} +.mbgExample { + background-color: #598559 !important; +} +.mbgExperience { + background-color: #BE995F !important; +} +.mbgForesight { + background-color: #b0b0b0 !important; +} +.mbgFutureDev { + background-color: #25A17F !important; +} +.mbgGoodPractice { + background-color: #BD9E86 !important; +} +.mbgGroup { + background-color: #7076BC !important; +} +.mbgIdea { + background-color: #c4bc5e !important; +} +.mbgImplication { + background-color: #83DECA !important; +} +.mbgInsight { + background-color: #B074AD !important; +} +.mbgIntention { + background-color: #baeaff !important; +} +.mbgKnowledge { + background-color: #60acf7 !important; +} +.mbgList { + background-color: #B7A499 !important; +} +.mbgLocation { + background-color: #abd9a7 !important; +} +.mbgMovieMap { + background-color: #a5a0de !important; +} +.mbgNote { + background-color: #a389a1 !important; +} +.mbgOpenIssue { + background-color: #9bbf71 !important; +} +.mbgOpinion { + background-color: #54a19d !important; +} +.mbgOpportunity { + background-color: #889F64 !important; +} +.mbgPerson { + background-color: #de925f !important; +} +.mbgPlatform { + background-color: #21C8FE !important; +} +.mbgPro { + background-color: #89b879 !important; +} +.mbgProblem { + background-color: #99cfc4 !important; +} +.mbgQuestion { + background-color: #709899 !important; +} +.mbgReference { + background-color: #A7A7A7 !important; +} +.mbgRequirement { + background-color: #d2a7d4 !important; +} +.mbgResearch { + background-color: #CD8E89 !important; +} +.mbgResource { + background-color: #c98c63 !important; +} +.mbgRole { + background-color: #a8595d !important; +} +.mbgTask { + background-color: #2f89ba !important; +} +.mbgTool { + background-color: #828282 !important; +} +.mbgTrajectory { + background-color: #b3953d !important; +} +.mbgWildcard { + background-color: #73c7de !important; +} \ No newline at end of file From c1885615cda3d003a336e427f1bf444e5942d63e Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 22:26:50 -0400 Subject: [PATCH 15/22] remove tilda file --- .../stylesheets/metacode_backgrounds.css | 120 ------------------ .../20140930013020_add_color_to_metacodes.rb~ | 5 - 2 files changed, 125 deletions(-) delete mode 100644 app/assets/stylesheets/metacode_backgrounds.css delete mode 100644 db/migrate/20140930013020_add_color_to_metacodes.rb~ diff --git a/app/assets/stylesheets/metacode_backgrounds.css b/app/assets/stylesheets/metacode_backgrounds.css deleted file mode 100644 index adf69d4e..00000000 --- a/app/assets/stylesheets/metacode_backgrounds.css +++ /dev/null @@ -1,120 +0,0 @@ -.mbgAction { - background-color: #bd6c85 !important; -} -.mbgActivity { - background-color: #6ebf65 !important; -} -.mbgArgument { - background-color: #7FAEFD !important; -} -.mbgBizarre { - background-color: #bdb25e !important; -} -.mbgCatalyst { - background-color: #EF8964 !important; -} -.mbgClosed { - background-color: #ABB49F !important; -} -.mbgCon { - background-color: #CF7C74 !important; -} -.mbgDecision { - background-color: #cca866 !important; -} -.mbgExample { - background-color: #598559 !important; -} -.mbgExperience { - background-color: #BE995F !important; -} -.mbgForesight { - background-color: #b0b0b0 !important; -} -.mbgFutureDev { - background-color: #25A17F !important; -} -.mbgGoodPractice { - background-color: #BD9E86 !important; -} -.mbgGroup { - background-color: #7076BC !important; -} -.mbgIdea { - background-color: #c4bc5e !important; -} -.mbgImplication { - background-color: #83DECA !important; -} -.mbgInsight { - background-color: #B074AD !important; -} -.mbgIntention { - background-color: #baeaff !important; -} -.mbgKnowledge { - background-color: #60acf7 !important; -} -.mbgList { - background-color: #B7A499 !important; -} -.mbgLocation { - background-color: #abd9a7 !important; -} -.mbgMovieMap { - background-color: #a5a0de !important; -} -.mbgNote { - background-color: #a389a1 !important; -} -.mbgOpenIssue { - background-color: #9bbf71 !important; -} -.mbgOpinion { - background-color: #54a19d !important; -} -.mbgOpportunity { - background-color: #889F64 !important; -} -.mbgPerson { - background-color: #de925f !important; -} -.mbgPlatform { - background-color: #21C8FE !important; -} -.mbgPro { - background-color: #89b879 !important; -} -.mbgProblem { - background-color: #99cfc4 !important; -} -.mbgQuestion { - background-color: #709899 !important; -} -.mbgReference { - background-color: #A7A7A7 !important; -} -.mbgRequirement { - background-color: #d2a7d4 !important; -} -.mbgResearch { - background-color: #CD8E89 !important; -} -.mbgResource { - background-color: #c98c63 !important; -} -.mbgRole { - background-color: #a8595d !important; -} -.mbgTask { - background-color: #2f89ba !important; -} -.mbgTool { - background-color: #828282 !important; -} -.mbgTrajectory { - background-color: #b3953d !important; -} -.mbgWildcard { - background-color: #73c7de !important; -} \ No newline at end of file diff --git a/db/migrate/20140930013020_add_color_to_metacodes.rb~ b/db/migrate/20140930013020_add_color_to_metacodes.rb~ deleted file mode 100644 index 59c8f89f..00000000 --- a/db/migrate/20140930013020_add_color_to_metacodes.rb~ +++ /dev/null @@ -1,5 +0,0 @@ -class AddColorToMetacodes < ActiveRecord::Migration - def change - add_column :metacodes, :color, :string - end -end From b1d27d42ff53e65e0a9e11294d783b82287d3d5d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 22:33:03 -0400 Subject: [PATCH 16/22] did one as example, need to do rest --- test/fixtures/metacodes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/fixtures/metacodes.yml b/test/fixtures/metacodes.yml index a1c750e1..230bef78 100644 --- a/test/fixtures/metacodes.yml +++ b/test/fixtures/metacodes.yml @@ -7,6 +7,7 @@ one: name: Action icon: /assets/icons/action.png + color: #bd6c85 two: name: Activity From 86e78919b35edd4ab07784e57505f8e7a6607568 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 30 Sep 2014 16:55:25 -0400 Subject: [PATCH 17/22] initial code for realtime, got new topic, new synapse, and topic drag working --- app/assets/javascripts/src/Metamaps.JIT.js | 41 ++- app/assets/javascripts/src/Metamaps.js | 330 ++++++++++++++------- realtime/realtime-server.js | 35 +++ 3 files changed, 287 insertions(+), 119 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 3c5b79c9..98b8ba7b 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -1,6 +1,11 @@ Metamaps.JIT = { events: { mouseMove: 'Metamaps:JIT:events:mouseMove', + topicDrag: 'Metamaps:JIT:events:topicDrag', + newTopic: 'Metamaps:JIT:events:newTopic', + removeTopic: 'Metamaps:JIT:events:removeTopic', + newSynapse: 'Metamaps:JIT:events:newSynapse', + removeSynapse: 'Metamaps:JIT:events:removeSynapse', pan: 'Metamaps:JIT:events:pan', zoom: 'Metamaps:JIT:events:zoom' }, @@ -703,6 +708,11 @@ Metamaps.JIT = { var self = Metamaps.JIT; + // this is used to send nodes that are moving to + // other realtime collaborators on the same map + var positionsToSend = {}; + var topic; + if (node && !node.nodeFrom) { var pos = eventInfo.getPos(); // if it's a left click, or a touch, move the node @@ -710,13 +720,23 @@ Metamaps.JIT = { //if the node dragged isn't already selected, select it var whatToDo = self.handleSelectionBeforeDragging(node, e); if (node.pos.rho || node.pos.rho === 0) { + // this means we're in topic view var rho = Math.sqrt(pos.x * pos.x + pos.y * pos.y); var theta = Math.atan2(pos.y, pos.x); node.pos.setp(theta, rho); } else if (whatToDo == 'only-drag-this-one') { node.pos.setc(pos.x, pos.y); - node.setData('xloc', pos.x); - node.setData('yloc', pos.y); + + if (Metamaps.Active.Map) { + topic = node.getData('topic'); + // we use the topic ID not the node id + // because we can't depend on the node id + // to be the same as on other collaborators + // maps + positionsToSend[topic.id] = pos; + $(document).trigger(Metamaps.JIT.events.topicDrag, [positionsToSend]); + $(document).trigger(Metamaps.JIT.events.mouseMove, [pos]); + } } else { var len = Metamaps.Selected.Nodes.length; @@ -734,9 +754,21 @@ Metamaps.JIT = { var x = pos.x + xOffset[i]; var y = pos.y + yOffset[i]; n.pos.setc(x, y); - n.setData('xloc', x); - n.setData('yloc', y); + + if (Metamaps.Active.Map) { + topic = n.getData('topic'); + // we use the topic ID not the node id + // because we can't depend on the node id + // to be the same as on other collaborators + // maps + positionsToSend[topic.id] = n.pos; + } } //for + + if (Metamaps.Active.Map) { + $(document).trigger(Metamaps.JIT.events.topicDrag, [positionsToSend]); + $(document).trigger(Metamaps.JIT.events.mouseMove, [pos]); + } } //if if (whatToDo == 'deselect') { @@ -807,6 +839,7 @@ Metamaps.JIT = { x: pos.x, y: pos.y }; + $(document).trigger(Metamaps.JIT.events.mouseMove, [pos]); } } } diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 83ece7d7..30243247 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1506,7 +1506,7 @@ Metamaps.Realtime = { }); $('body').click(self.close); - self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); + self.socket = io.connect('http://localhost:5001'); self.startActiveMap(); }, toggleBox: function (event) { @@ -1619,14 +1619,30 @@ Metamaps.Realtime = { // receive word that there's a mapper turned on realtime socket.on('maps-' + Metamaps.Active.Map.id + '-lostrealtime', self.lostCollaborator); - socket.on('maps-' + Metamaps.Active.Map.id, self.contentUpdate); + // + socket.on('maps-' + Metamaps.Active.Map.id + '-topicDrag', self.topicDrag); + + // + socket.on('maps-' + Metamaps.Active.Map.id + '-newTopic', self.newTopic); + + // + socket.on('maps-' + Metamaps.Active.Map.id + '-removeTopic', self.removeTopic); + + // + socket.on('maps-' + Metamaps.Active.Map.id + '-newSynapse', self.newSynapse); + + // + socket.on('maps-' + Metamaps.Active.Map.id + '-removeSynapse', self.removeSynapse); // update mapper compass position socket.on('maps-' + Metamaps.Active.Map.id + '-updatePeerCoords', self.updatePeerCoords); + // local event listeners that trigger events var sendCoords = function (event, coords) { self.sendCoords(coords); }; + $(document).on(Metamaps.JIT.events.mouseMove, sendCoords); + var zoom = function (event, e) { if (e) { var pixels = { @@ -1638,9 +1654,35 @@ Metamaps.Realtime = { } self.positionPeerIcons(); }; - $(document).on(Metamaps.JIT.events.mouseMove, sendCoords); $(document).on(Metamaps.JIT.events.zoom, zoom); + $(document).on(Metamaps.JIT.events.pan, self.positionPeerIcons); + + var sendTopicDrag = function (event, positions) { + self.sendTopicDrag(positions); + }; + $(document).on(Metamaps.JIT.events.topicDrag, sendTopicDrag); + + var sendNewTopic = function (event, data) { + self.sendNewTopic(data); + }; + $(document).on(Metamaps.JIT.events.newTopic, sendNewTopic); + + var sendRemoveTopic = function (event, data) { + self.sendRemoveTopic(data); + }; + $(document).on(Metamaps.JIT.events.removeTopic, sendRemoveTopic); + + var sendNewSynapse = function (event, data) { + self.sendNewSynapse(data); + }; + $(document).on(Metamaps.JIT.events.newSynapse, sendNewSynapse); + + var sendRemoveSynapse = function (event, data) { + self.sendRemoveSynapse(data); + }; + $(document).on(Metamaps.JIT.events.removeSynapse, sendRemoveSynapse); + }, sendRealtimeOn: function () { var self = Metamaps.Realtime; @@ -1899,120 +1941,150 @@ Metamaps.Realtime = { socket.emit('updateMapperCoords', update); } }, - contentUpdate: function (data) { + sendTopicDrag: function (positions) { var self = Metamaps.Realtime; - var socket = Metamaps.Realtime.socket; - var graph = Metamaps.Visualize.mGraph.graph; + var socket = self.socket; - //as long as you weren't the origin of the changes, update your map - if (data.origin != Metamaps.Active.Mapper.id && self.status) { - if (data.resource == 'Topic') { - topic = $.parseJSON(data.obj); + if (Metamaps.Active.Map && self.status) { + positions.mapid = Metamaps.Active.Map.id; + socket.emit('topicDrag', positions); + } + }, + topicDrag: function (positions) { + var self = Metamaps.Realtime; + var socket = self.socket; - if (data.action == 'create') { - self.addTopicToMap(topic); - } else if (data.action == 'update' && graph.getNode(topic.id) != 'undefined') { - self.updateTopicOnMap(topic); - } else if (data.action == 'destroy' && graph.getNode(topic.id) != 'undefined') { - Metamaps.Control.hideNode(topic.id) - } + var topic; + var node; - return; - } else if (data.resource == 'Synapse') { - synapse = $.parseJSON(data.obj); + if (Metamaps.Active.Map && self.status) { + for (var key in positions) { + topic = Metamaps.Topics.get(key); + if (topic) node = topic.get('node'); + if (node) node.pos.setc(positions[key].x, positions[key].y); + } //for + Metamaps.Visualize.mGraph.plot(); + } + }, + // newTopic + sendNewTopic: function (data) { + var self = Metamaps.Realtime; + var socket = self.socket; - if (data.action == 'create') { - self.addSynapseToMap(synapse); - } else if (data.action == 'update' && - graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') { - self.updateSynapseOnMap(synapse); - } else if (data.action == 'destroy' && - graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') { - var edge = graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']); - Metamaps.Control.hideEdge(edge); - } + if (Metamaps.Active.Map && self.status) { + data.mapid = Metamaps.Active.Map.id; + socket.emit('newTopic', data); + } + }, + newTopic: function (data) { + var topic, mapping, cancel; - return; + function test() { + if (topic && mapping) { + Metamaps.Topic.renderTopic(mapping, topic, false, false); + } + else if (!cancel) { + setTimeout(test, 10); } } - }, - addTopicToMap: function (topic) { + test(); - // TODO - var newPos, tempForT; - Metamaps.Visualize.mGraph.graph.addNode(topic); - tempForT = Metamaps.Visualize.mGraph.graph.getNode(topic.id); - tempForT.setData('dim', 1, 'start'); - tempForT.setData('dim', 25, 'end'); - newPos = new $jit.Complex(); - newPos.x = tempForT.data.$xloc; - newPos.y = tempForT.data.$yloc; - tempForT.setPos(newPos, 'start'); - tempForT.setPos(newPos, 'current'); - tempForT.setPos(newPos, 'end'); - Metamaps.Visualize.mGraph.fx.plotNode(tempForT, Metamaps.Visualize.mGraph.canvas); + $.ajax({ + url: "/topics/" + data.topicid + ".json", + success: function (response) { + Metamaps.Topics.add(response); + topic = Metamaps.Topics.get(response.id); + }, + error: function () { + cancel = true; + } + }); + $.ajax({ + url: "/mappings/" + data.mappingid + ".json", + success: function (response) { + Metamaps.Mappings.add(response); + mapping = Metamaps.Mappings.get(response.id); + }, + error: function () { + cancel = true; + } + }); }, - updateTopicOnMap: function (topic) { + // removeTopic + sendRemoveTopic: function (data) { + var self = Metamaps.Realtime; + var socket = self.socket; - // TODO - var newPos, tempForT; - tempForT = Metamaps.Visualize.mGraph.graph.getNode(topic.id); - tempForT.data = topic.data; - tempForT.name = topic.name; - if (MetamapsModel.showcardInUse === topic.id) { - populateShowCard(tempForT); + if (Metamaps.Active.Map && self.status) { + data.mapid = Metamaps.Active.Map.id; + socket.emit('removeTopic', data); } - newPos = new $jit.Complex(); - newPos.x = tempForT.data.$xloc; - newPos.y = tempForT.data.$yloc; - tempForT.setPos(newPos, 'start'); - tempForT.setPos(newPos, 'current'); - tempForT.setPos(newPos, 'end'); - return Metamaps.Visualize.mGraph.fx.animate({ - modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'], - transition: $jit.Trans.Quad.easeInOut, - duration: 500 + }, + removeTopic: function (data) { + + }, + // newSynapse + sendNewSynapse: function (data) { + var self = Metamaps.Realtime; + var socket = self.socket; + + if (Metamaps.Active.Map && self.status) { + data.mapid = Metamaps.Active.Map.id; + socket.emit('newSynapse', data); + } + }, + newSynapse: function (data) { + var topic1, topic2, node1, node2, synapse, mapping, cancel; + + function test() { + if (synapse && mapping) { + topic1 = synapse.getTopic1(); + node1 = topic1.get('node'); + topic2 = synapse.getTopic2(); + node2 = topic2.get('node'); + + Metamaps.Synapse.renderSynapse(mapping, synapse, node1, node2, false); + } + else if (!cancel) { + setTimeout(test, 10); + } + } + test(); + + $.ajax({ + url: "/synapses/" + data.synapseid + ".json", + success: function (response) { + Metamaps.Synapses.add(response); + synapse = Metamaps.Synapses.get(response.id); + }, + error: function () { + cancel = true; + } + }); + $.ajax({ + url: "/mappings/" + data.mappingid + ".json", + success: function (response) { + Metamaps.Mappings.add(response); + mapping = Metamaps.Mappings.get(response.id); + }, + error: function () { + cancel = true; + } }); }, - addSynapseToMap: function (synapse) { + // removeSynapse + sendRemoveSynapse: function (data) { + var self = Metamaps.Realtime; + var socket = self.socket; - // TODO - var Node1, Node2, tempForS; - Node1 = Metamaps.Visualize.mGraph.graph.getNode(synapse.data.$direction[0]); - Node2 = Metamaps.Visualize.mGraph.graph.getNode(synapse.data.$direction[1]); - Metamaps.Visualize.mGraph.graph.addAdjacence(Node1, Node2, {}); - tempForS = Metamaps.Visualize.mGraph.graph.getAdjacence(Node1.id, Node2.id); - tempForS.setDataset('start', { - lineWidth: 0.4 - }); - tempForS.setDataset('end', { - lineWidth: 2 - }); - tempForS.data = synapse.data; - Metamaps.Visualize.mGraph.fx.plotLine(tempForS, Metamaps.Visualize.mGraph.canvas); - return Metamaps.Visualize.mGraph.fx.animate({ - modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'], - transition: $jit.Trans.Quad.easeInOut, - duration: 500 - }); + if (Metamaps.Active.Map && self.status) { + data.mapid = Metamaps.Active.Map.id; + socket.emit('removeSynapse', data); + } + }, + removeSynapse: function (data) { + }, - updateSynapseOnMap: function (synapse) { - - // TODO - var k, tempForS, v, wasShowDesc, _ref; - tempForS = Metamaps.Visualize.mGraph.graph.getAdjacence(synapse.data.$direction[0], synapse.data.$direction[1]); - wasShowDesc = tempForS.data.$showDesc; - _ref = synapse.data; - for (k in _ref) { - v = _ref[k]; - tempForS.data[k] = v; - } - tempForS.data.$showDesc = wasShowDesc; - if (MetamapsModel.edgecardInUse === synapse.data.$id) { // TODO - editEdge(tempForS, false); - } - return Metamaps.Visualize.mGraph.plot(); - } }; // end Metamaps.Realtime @@ -2902,7 +2974,7 @@ Metamaps.Topic = { * * */ - renderTopic: function (mapping, topic, createNewInDB) { + renderTopic: function (mapping, topic, createNewInDB, permitCreateSynapseAfter) { var self = Metamaps.Topic; var nodeOnViz, tempPos; @@ -2935,7 +3007,7 @@ Metamaps.Topic = { nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "start"); nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "end"); } - if (Metamaps.Create.newTopic.addSynapse) { + if (Metamaps.Create.newTopic.addSynapse && permitCreateSynapseAfter) { Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id; // position the form @@ -2986,10 +3058,22 @@ Metamaps.Topic = { }); } + var mappingSuccessCallback = function (mappingModel, response) { + var newTopicData = { + mappingid: mappingModel.id, + topicid: mappingModel.get('topic_id') + }; - var successCallback = function (topicModel, response) { + $(document).trigger(Metamaps.JIT.events.newTopic, [newTopicData]); + }; + var topicSuccessCallback = function (topicModel, response) { if (Metamaps.Active.Map) { - mapping.save({ topic_id: topicModel.id }); + mapping.save({ topic_id: topicModel.id }, { + success: mappingSuccessCallback, + error: function (model, response) { + console.log('error saving mapping to database'); + } + }); } if (Metamaps.Create.newTopic.addSynapse) { @@ -3000,13 +3084,15 @@ Metamaps.Topic = { if (!Metamaps.Settings.sandbox && createNewInDB) { if (topic.isNew()) { topic.save(null, { - success: successCallback, + success: topicSuccessCallback, error: function (model, response) { console.log('error saving topic to database'); } }); } else if (!topic.isNew() && Metamaps.Active.Map) { - mapping.save(); + mapping.save(null, { + success: mappingSuccessCallback + }); } } }, @@ -3034,7 +3120,7 @@ Metamaps.Topic = { //these can't happen until the value is retrieved, which happens in the line above Metamaps.Create.newTopic.hide(); - self.renderTopic(mapping, topic, true); // this function also includes the creation of the topic in the database + self.renderTopic(mapping, topic, true, true); // this function also includes the creation of the topic in the database }, getTopicFromAutocomplete: function (id) { var self = Metamaps.Topic; @@ -3051,7 +3137,7 @@ Metamaps.Topic = { }); Metamaps.Mappings.add(mapping); - self.renderTopic(mapping, topic, true); + self.renderTopic(mapping, topic, true, true); } }; // end Metamaps.Topic @@ -3110,20 +3196,34 @@ Metamaps.Synapse = { Metamaps.Visualize.mGraph.fx.plotLine(edgeOnViz, Metamaps.Visualize.mGraph.canvas); Metamaps.Control.selectEdge(edgeOnViz); + var mappingSuccessCallback = function (mappingModel, response) { + var newSynapseData = { + mappingid: mappingModel.id, + synapseid: mappingModel.get('synapse_id') + }; + + $(document).trigger(Metamaps.JIT.events.newSynapse, [newSynapseData]); + }; + var synapseSuccessCallback = function (synapseModel, response) { + if (Metamaps.Active.Map) { + mapping.save({ synapse_id: synapseModel.id }, { + success: mappingSuccessCallback + }); + } + }; + if (!Metamaps.Settings.sandbox && createNewInDB) { if (synapse.isNew()) { synapse.save(null, { - success: function (synapseModel, response) { - if (Metamaps.Active.Map) { - mapping.save({ synapse_id: synapseModel.id }); - } - }, + success: synapseSuccessCallback, error: function (model, response) { console.log('error saving synapse to database'); } }); } else if (!synapse.isNew() && Metamaps.Active.Map) { - mapping.save(); + mapping.save(null, { + success: mappingSuccessCallback + }); } } }, diff --git a/realtime/realtime-server.js b/realtime/realtime-server.js index fe6524cc..28db52cf 100644 --- a/realtime/realtime-server.js +++ b/realtime/realtime-server.js @@ -113,6 +113,41 @@ function start() { socket.broadcast.emit('maps-' + data.mapid + '-updatePeerCoords', peer); }); + socket.on('topicDrag', function (data) { + var mapId = data.mapid; + delete data.mapid; + + socket.broadcast.emit('maps-' + mapId + '-topicDrag', data); + }); + + socket.on('newTopic', function (data) { + var mapId = data.mapid; + delete data.mapid; + + socket.broadcast.emit('maps-' + mapId + '-newTopic', data); + }); + + socket.on('removeTopic', function (data) { + var mapId = data.mapid; + delete data.mapid; + + socket.broadcast.emit('maps-' + mapId + '-removeTopic', data); + }); + + socket.on('newSynapse', function (data) { + var mapId = data.mapid; + delete data.mapid; + + socket.broadcast.emit('maps-' + mapId + '-newSynapse', data); + }); + + socket.on('removeSynapse', function (data) { + var mapId = data.mapid; + delete data.mapid; + + socket.broadcast.emit('maps-' + mapId + '-removeSynapse', data); + }); + }); } From 81f31ea10e376b84d7cb7028d3a5d50fa56bbd9e Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 30 Sep 2014 16:59:19 -0400 Subject: [PATCH 18/22] heroku --- app/assets/javascripts/src/Metamaps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 30243247..eaa8df8e 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1506,7 +1506,7 @@ Metamaps.Realtime = { }); $('body').click(self.close); - self.socket = io.connect('http://localhost:5001'); + self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); self.startActiveMap(); }, toggleBox: function (event) { From eccc433627805bd951e04bbbfaf50b167714948c Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 30 Sep 2014 18:13:49 -0400 Subject: [PATCH 19/22] fixed realtime bug where couldn't populate filters because it was missing a new mapper model that just added something --- app/assets/javascripts/src/Metamaps.js | 29 +++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index eaa8df8e..83128629 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1972,23 +1972,31 @@ Metamaps.Realtime = { var socket = self.socket; if (Metamaps.Active.Map && self.status) { + data.mapperid = Metamaps.Active.Mapper.id; data.mapid = Metamaps.Active.Map.id; socket.emit('newTopic', data); } }, newTopic: function (data) { - var topic, mapping, cancel; + var topic, mapping, mapper, mapperCallback, cancel; function test() { - if (topic && mapping) { + if (topic && mapping && mapper) { Metamaps.Topic.renderTopic(mapping, topic, false, false); } else if (!cancel) { setTimeout(test, 10); } } - test(); + mapper = Metamaps.Mappers.get(data.mapperid); + if (mapper === undefined) { + mapperCallback = function (m) { + Metamaps.Mappers.add(m); + mapper = m; + }; + Metamaps.Mapper.get(data.mapperid, mapperCallback); + } $.ajax({ url: "/topics/" + data.topicid + ".json", success: function (response) { @@ -2009,6 +2017,8 @@ Metamaps.Realtime = { cancel = true; } }); + + test(); }, // removeTopic sendRemoveTopic: function (data) { @@ -2029,6 +2039,7 @@ Metamaps.Realtime = { var socket = self.socket; if (Metamaps.Active.Map && self.status) { + data.mapperid = Metamaps.Active.Mapper.id; data.mapid = Metamaps.Active.Map.id; socket.emit('newSynapse', data); } @@ -2037,7 +2048,7 @@ Metamaps.Realtime = { var topic1, topic2, node1, node2, synapse, mapping, cancel; function test() { - if (synapse && mapping) { + if (synapse && mapping && mapper) { topic1 = synapse.getTopic1(); node1 = topic1.get('node'); topic2 = synapse.getTopic2(); @@ -2049,8 +2060,15 @@ Metamaps.Realtime = { setTimeout(test, 10); } } - test(); + mapper = Metamaps.Mappers.get(data.mapperid); + if (mapper === undefined) { + mapperCallback = function (m) { + Metamaps.Mappers.add(m); + mapper = m; + }; + Metamaps.Mapper.get(data.mapperid, mapperCallback); + } $.ajax({ url: "/synapses/" + data.synapseid + ".json", success: function (response) { @@ -2071,6 +2089,7 @@ Metamaps.Realtime = { cancel = true; } }); + test(); }, // removeSynapse sendRemoveSynapse: function (data) { From 57fb6a15c404f4e48d2be3aa7c905cc0580879e6 Mon Sep 17 00:00:00 2001 From: Shai Mor Date: Wed, 1 Oct 2014 09:54:56 -0400 Subject: [PATCH 20/22] start on search results styling, pulled in external js libraries and css --- app/assets/images/arrow_sprite-alt.png | Bin 0 -> 715 bytes app/assets/images/arrowpermswhite_sprite.png | Bin 0 -> 540 bytes app/assets/javascripts/application.js | 5 +- app/assets/javascripts/famous/famous.min.js | 50 ++++++ app/assets/javascripts/lib/barometer.js | 32 ++++ app/assets/javascripts/require/require.js | 36 +++++ app/assets/javascripts/shims/classList.js | 138 ++++++++++++++++ .../shims/functionPrototypeBind.js | 23 +++ .../shims/requestAnimationFrame.js | 13 ++ .../javascripts/src/Metamaps.GlobalUI.js | 3 +- app/assets/stylesheets/application.css | 3 - app/assets/stylesheets/barometer.css | 151 ++++++++++++++++++ app/assets/stylesheets/clean.css | 125 +++++++++------ app/assets/stylesheets/famous.css | 77 +++++++++ app/helpers/topics_helper.rb | 2 +- app/views/layouts/_templates.html.erb | 14 +- app/views/layouts/application.html.erb | 15 -- 17 files changed, 609 insertions(+), 78 deletions(-) create mode 100644 app/assets/images/arrow_sprite-alt.png create mode 100644 app/assets/images/arrowpermswhite_sprite.png create mode 100644 app/assets/javascripts/famous/famous.min.js create mode 100644 app/assets/javascripts/lib/barometer.js create mode 100644 app/assets/javascripts/require/require.js create mode 100644 app/assets/javascripts/shims/classList.js create mode 100644 app/assets/javascripts/shims/functionPrototypeBind.js create mode 100644 app/assets/javascripts/shims/requestAnimationFrame.js create mode 100644 app/assets/stylesheets/barometer.css create mode 100644 app/assets/stylesheets/famous.css diff --git a/app/assets/images/arrow_sprite-alt.png b/app/assets/images/arrow_sprite-alt.png new file mode 100644 index 0000000000000000000000000000000000000000..b60c7af5cc8801251307581231e4ecacfa4b70ef GIT binary patch literal 715 zcmV;+0yO=JP){h{X!Y~lD^W+nE03F0skjzj(D1i>*RDjb#(g7tn1u)}u;B;VjARh2__Q*Lo z$&xJi@R4Q~Y~7yjSXp?}zVDM;j=SW>BQ|huV6|E;E=`=up*T=87E=n8AT>Z9P&g+p z<#;$7d=cl7(eT`8q;v`pRJgw9xwrj(Upf}1`7Pfbz{`v{-S2>BM{l3N26@U=k>$=fRHVba(a%W zax`b-pZx&%(GSE1Vgs>(-v&;n)5U&ZDu?1g&6xHBAT>Z9P&g;9&krCz@&i0K9`sLm zJRTL$GfJAXfntKEEb$De1jhu$GMQub1Ey?)oIXE*c(5N}uI>kTGT0ByX0u8ZxB3Ba znqk{)egJXZ4}cit2au?YU$6NA#7oDsq4@#uGS^-g#&bc}h3DDW0WFZbID(rqcSrZm x*RhZ-k#c&Dq%xK9@Xvk#{OAW_1Idp70|2a=d`;+b3W5Lt002ovPDHLkV1iA)JEs5u literal 0 HcmV?d00001 diff --git a/app/assets/images/arrowpermswhite_sprite.png b/app/assets/images/arrowpermswhite_sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..53385c2330fba8de297d7af55960c63520743554 GIT binary patch literal 540 zcmV+%0^|LOP){!upgD?z*e)5xS5H={8pxvPE2H7Cqpmc*|12RFA4d?_V8;}j?2mDg0C+>2b zZ5%oILb}uW4$BYe>0u0U-}lj+?J1hM2?0WY5Fi8y0YZQfAOx_i>$(iQ!0{2u0j>_k zhV`%DxitWf!W?hgR)aU-J&l@+<+#UypEK4j!FNM`wz&A#ZvkL4g`og{F-(7hZ;~Xb z@6de(!xsmeRD(G_UtNBOwa1`GfRd^##Yc3#qPS2?E!cV@N0j@|sCX0Jzj-MDK$pbm zn_>FoxQ-ob0#ty-eE49KGLMGB(LNzIXKjMGiNH`Biu@&6VYk=dm(e`N*R-Bxlr&N;;&I*DR=iUI)OB3A_3VHvevfm3YS>w@k@%JAo^U@sh3g`~BtPuB2H;{s zF(}1_uMBT_rO~6fa)e!|Ic4ZMpfc?6nX7n`ZAlx>X#$V)NFX-u@CQrCfpRRpK|SBY zn)x1AgwZ_UjG#v65XHgqIqYPCiKgJ2dlPVV*vWC^V#M-OR6d4;03kpK5CVh%AwUQa e0_JId0t^8A|Ln`O!Q9ON0000t?-1:1}var r={};r.precision=1e-6,r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.multiply4x4=function(t,i){return[t[0]*i[0]+t[4]*i[1]+t[8]*i[2]+t[12]*i[3],t[1]*i[0]+t[5]*i[1]+t[9]*i[2]+t[13]*i[3],t[2]*i[0]+t[6]*i[1]+t[10]*i[2]+t[14]*i[3],t[3]*i[0]+t[7]*i[1]+t[11]*i[2]+t[15]*i[3],t[0]*i[4]+t[4]*i[5]+t[8]*i[6]+t[12]*i[7],t[1]*i[4]+t[5]*i[5]+t[9]*i[6]+t[13]*i[7],t[2]*i[4]+t[6]*i[5]+t[10]*i[6]+t[14]*i[7],t[3]*i[4]+t[7]*i[5]+t[11]*i[6]+t[15]*i[7],t[0]*i[8]+t[4]*i[9]+t[8]*i[10]+t[12]*i[11],t[1]*i[8]+t[5]*i[9]+t[9]*i[10]+t[13]*i[11],t[2]*i[8]+t[6]*i[9]+t[10]*i[10]+t[14]*i[11],t[3]*i[8]+t[7]*i[9]+t[11]*i[10]+t[15]*i[11],t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12]*i[15],t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13]*i[15],t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14]*i[15],t[3]*i[12]+t[7]*i[13]+t[11]*i[14]+t[15]*i[15]]},r.multiply=function(t,i){return[t[0]*i[0]+t[4]*i[1]+t[8]*i[2],t[1]*i[0]+t[5]*i[1]+t[9]*i[2],t[2]*i[0]+t[6]*i[1]+t[10]*i[2],0,t[0]*i[4]+t[4]*i[5]+t[8]*i[6],t[1]*i[4]+t[5]*i[5]+t[9]*i[6],t[2]*i[4]+t[6]*i[5]+t[10]*i[6],0,t[0]*i[8]+t[4]*i[9]+t[8]*i[10],t[1]*i[8]+t[5]*i[9]+t[9]*i[10],t[2]*i[8]+t[6]*i[9]+t[10]*i[10],0,t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12],t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13],t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14],1]},r.thenMove=function(t,i){return i[2]||(i[2]=0),[t[0],t[1],t[2],0,t[4],t[5],t[6],0,t[8],t[9],t[10],0,t[12]+i[0],t[13]+i[1],t[14]+i[2],1]},r.moveThen=function(t,i){t[2]||(t[2]=0);var e=t[0]*i[0]+t[1]*i[4]+t[2]*i[8],s=t[0]*i[1]+t[1]*i[5]+t[2]*i[9],o=t[0]*i[2]+t[1]*i[6]+t[2]*i[10];return r.thenMove(i,[e,s,o])},r.translate=function(t,i,e){return void 0===e&&(e=0),[1,0,0,0,0,1,0,0,0,0,1,0,t,i,e,1]},r.thenScale=function(t,i){return[i[0]*t[0],i[1]*t[1],i[2]*t[2],0,i[0]*t[4],i[1]*t[5],i[2]*t[6],0,i[0]*t[8],i[1]*t[9],i[2]*t[10],0,i[0]*t[12],i[1]*t[13],i[2]*t[14],1]},r.scale=function(t,i,e){return void 0===e&&(e=1),[t,0,0,0,0,i,0,0,0,0,e,0,0,0,0,1]},r.rotateX=function(t){var i=Math.cos(t),e=Math.sin(t);return[1,0,0,0,0,i,e,0,0,-e,i,0,0,0,0,1]},r.rotateY=function(t){var i=Math.cos(t),e=Math.sin(t);return[i,0,-e,0,0,1,0,0,e,0,i,0,0,0,0,1]},r.rotateZ=function(t){var i=Math.cos(t),e=Math.sin(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]},r.rotate=function(t,i,e){var s=Math.cos(t),o=Math.sin(t),n=Math.cos(i),r=Math.sin(i),a=Math.cos(e),h=Math.sin(e),u=[n*a,s*h+o*r*a,o*h-s*r*a,0,-n*h,s*a-o*r*h,o*a+s*r*h,0,r,-o*n,s*n,0,0,0,0,1];return u},r.rotateAxis=function(t,i){var e=Math.sin(i),s=Math.cos(i),o=1-s,n=t[0]*t[0]*o,r=t[0]*t[1]*o,a=t[0]*t[2]*o,h=t[1]*t[1]*o,u=t[1]*t[2]*o,c=t[2]*t[2]*o,p=t[0]*e,l=t[1]*e,f=t[2]*e,d=[n+s,r+f,a-l,0,r-f,h+s,u+p,0,a+l,u-p,c+s,0,0,0,0,1];return d},r.aboutOrigin=function(t,i){var e=t[0]-(t[0]*i[0]+t[1]*i[4]+t[2]*i[8]),s=t[1]-(t[0]*i[1]+t[1]*i[5]+t[2]*i[9]),o=t[2]-(t[0]*i[2]+t[1]*i[6]+t[2]*i[10]);return r.thenMove(i,[e,s,o])},r.skew=function(t,i,e){return[1,0,0,0,Math.tan(e),1,0,0,Math.tan(i),Math.tan(t),1,0,0,0,0,1]},r.skewX=function(t){return[1,0,0,0,Math.tan(t),1,0,0,0,0,1,0,0,0,0,1]},r.skewY=function(t){return[1,Math.tan(t),0,0,0,1,0,0,0,0,1,0,0,0,0,1]},r.perspective=function(t){return[1,0,0,0,0,1,0,0,0,0,1,-1/t,0,0,0,1]},r.getTranslate=function(t){return[t[12],t[13],t[14]]},r.inverse=function(t){var i=t[5]*t[10]-t[6]*t[9],e=t[4]*t[10]-t[6]*t[8],s=t[4]*t[9]-t[5]*t[8],o=t[1]*t[10]-t[2]*t[9],n=t[0]*t[10]-t[2]*t[8],r=t[0]*t[9]-t[1]*t[8],a=t[1]*t[6]-t[2]*t[5],h=t[0]*t[6]-t[2]*t[4],u=t[0]*t[5]-t[1]*t[4],c=t[0]*i-t[1]*e+t[2]*s,p=1/c,l=[p*i,-p*o,p*a,0,-p*e,p*n,-p*h,0,p*s,-p*r,p*u,0,0,0,0,1];return l[12]=-t[12]*l[0]-t[13]*l[4]-t[14]*l[8],l[13]=-t[12]*l[1]-t[13]*l[5]-t[14]*l[9],l[14]=-t[12]*l[2]-t[13]*l[6]-t[14]*l[10],l},r.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},r.interpret=function(t){var i=[t[0],t[1],t[2]],e=n(i[0]),a=o(i),h=[i[0]+e*a,i[1],i[2]],u=2/s(h);if(u>=1/0)return{translate:r.getTranslate(t),rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]};var c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];c[0]=1-u*h[0]*h[0],c[5]=1-u*h[1]*h[1],c[10]=1-u*h[2]*h[2],c[1]=-u*h[0]*h[1],c[2]=-u*h[0]*h[2],c[6]=-u*h[1]*h[2],c[4]=c[1],c[8]=c[2],c[9]=c[6];var p=r.multiply(c,t),l=[p[5],p[6]],f=n(l[0]),d=o(l),m=[l[0]+f*d,l[1]],y=2/s(m),_=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];_[5]=1-y*m[0]*m[0],_[10]=1-y*m[1]*m[1],_[6]=-y*m[0]*m[1],_[9]=_[6];var g=r.multiply(_,c),v=r.multiply(g,t),O=r.scale(v[0]<0?-1:1,v[5]<0?-1:1,v[10]<0?-1:1);v=r.multiply(v,O),g=r.multiply(O,g);var T={};return T.translate=r.getTranslate(t),T.rotate=[Math.atan2(-g[6],g[10]),Math.asin(g[2]),Math.atan2(-g[1],g[0])],T.rotate[0]||(T.rotate[0]=0,T.rotate[2]=Math.atan2(g[4],g[5])),T.scale=[v[0],v[5],v[10]],T.skew=[Math.atan2(v[9],T.scale[2]),Math.atan2(v[8],T.scale[2]),Math.atan2(v[4],T.scale[0])],Math.abs(T.rotate[0])+Math.abs(T.rotate[2])>1.5*Math.PI&&(T.rotate[1]=Math.PI-T.rotate[1],T.rotate[1]>Math.PI&&(T.rotate[1]-=2*Math.PI),T.rotate[1]<-Math.PI&&(T.rotate[1]+=2*Math.PI),T.rotate[0]<0?T.rotate[0]+=Math.PI:T.rotate[0]-=Math.PI,T.rotate[2]<0?T.rotate[2]+=Math.PI:T.rotate[2]-=Math.PI),T},r.average=function(t,i,e){e=void 0===e?.5:e;for(var s=r.interpret(t),o=r.interpret(i),n={translate:[0,0,0],rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]},a=0;3>a;a++)n.translate[a]=(1-e)*s.translate[a]+e*o.translate[a],n.rotate[a]=(1-e)*s.rotate[a]+e*o.rotate[a],n.scale[a]=(1-e)*s.scale[a]+e*o.scale[a],n.skew[a]=(1-e)*s.skew[a]+e*o.skew[a];return r.build(n)},r.build=function(t){var i=r.scale(t.scale[0],t.scale[1],t.scale[2]),e=r.skew(t.skew[0],t.skew[1],t.skew[2]),s=r.rotate(t.rotate[0],t.rotate[1],t.rotate[2]);return r.thenMove(r.multiply(r.multiply(s,e),i),t.translate)},r.equals=function(t,i){return!r.notEquals(t,i)},r.notEquals=function(t,i){return t===i?!1:!(t&&i)||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]},r.normalizeRotation=function(t){var i=t.slice(0);for((i[0]===.5*Math.PI||i[0]===.5*-Math.PI)&&(i[0]=-i[0],i[1]=Math.PI-i[1],i[2]-=Math.PI),i[0]>.5*Math.PI&&(i[0]=i[0]-Math.PI,i[1]=Math.PI-i[1],i[2]-=Math.PI),i[0]<.5*-Math.PI&&(i[0]=i[0]+Math.PI,i[1]=-Math.PI-i[1],i[2]-=Math.PI);i[1]<-Math.PI;)i[1]+=2*Math.PI;for(;i[1]>=Math.PI;)i[1]-=2*Math.PI;for(;i[2]<-Math.PI;)i[2]+=2*Math.PI;for(;i[2]>=Math.PI;)i[2]-=2*Math.PI;return i},r.inFront=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,.001,1],r.behind=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,-.001,1],e.exports=r}),define("famous/core/SpecParser",["require","exports","module","./Transform"],function(t,i,e){function s(){this.result={}}function o(t,i){return[t[0]*i[0]+t[1]*i[4]+t[2]*i[8],t[0]*i[1]+t[1]*i[5]+t[2]*i[9],t[0]*i[2]+t[1]*i[6]+t[2]*i[10]]}var n=t("./Transform");s._instance=new s,s.parse=function(t,i){return s._instance.parse(t,i)},s.prototype.parse=function(t,i){return this.reset(),this._parseSpec(t,i,n.identity),this.result},s.prototype.reset=function(){this.result={}};var r=[0,0];s.prototype._parseSpec=function(t,i,e){var s,a,h,u,c,p,l;if("number"==typeof t){if(s=t,h=i.transform,p=i.align||i.origin,i.size&&p&&(p[0]||p[1])){var f=[p[0]*i.size[0],p[1]*i.size[1],0];h=n.thenMove(h,o(f,e))}this.result[s]={transform:h,opacity:i.opacity,origin:i.origin||r,align:i.align||i.origin||r,size:i.size}}else{if(!t)return;if(t instanceof Array)for(var d=0;de&&this.listeners[t].push(i),this},s.prototype.addListener=s.prototype.on,s.prototype.removeListener=function(t,i){var e=this.listeners[t].indexOf(i);return e>=0&&this.listeners[t].splice(e,1),this},s.prototype.bindThis=function(t){this._owner=t},e.exports=s}),define("famous/core/EventHandler",["require","exports","module","./EventEmitter"],function(t,i,e){function s(){o.apply(this,arguments),this.downstream=[],this.downstreamFn=[],this.upstream=[],this.upstreamListeners={}}var o=t("./EventEmitter");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.setInputHandler=function(t,i){t.trigger=i.trigger.bind(i),i.subscribe&&i.unsubscribe&&(t.subscribe=i.subscribe.bind(i),t.unsubscribe=i.unsubscribe.bind(i))},s.setOutputHandler=function(t,i){i instanceof s&&i.bindThis(t),t.pipe=i.pipe.bind(i),t.unpipe=i.unpipe.bind(i),t.on=i.on.bind(i),t.addListener=t.on,t.removeListener=i.removeListener.bind(i)},s.prototype.emit=function(t,i){o.prototype.emit.apply(this,arguments);var e=0;for(e=0;ee&&i.push(t),t instanceof Function?t("pipe",null):t.trigger&&t.trigger("pipe",null),t},s.prototype.unpipe=function(t){if(t.unsubscribe instanceof Function)return t.unsubscribe(this);var i=t instanceof Function?this.downstreamFn:this.downstream,e=i.indexOf(t);return e>=0?(i.splice(e,1),t instanceof Function?t("unpipe",null):t.trigger&&t.trigger("unpipe",null),t):!1},s.prototype.on=function(t){if(o.prototype.on.apply(this,arguments),!(t in this.upstreamListeners)){var i=this.trigger.bind(this,t);this.upstreamListeners[t]=i;for(var e=0;ei){this.upstream.push(t);for(var e in this.upstreamListeners)t.on(e,this.upstreamListeners[e])}return this},s.prototype.unsubscribe=function(t){var i=this.upstream.indexOf(t);if(i>=0){this.upstream.splice(i,1);for(var e in this.upstreamListeners)t.removeListener(e,this.upstreamListeners[e])}return this},e.exports=s}),define("famous/core/ElementAllocator",["require","exports","module"],function(t,i,e){function s(t){t||(t=document.createDocumentFragment()),this.container=t,this.detachedNodes={},this.nodeCount=0}s.prototype.migrate=function(t){var i=this.container;if(t!==i){if(i instanceof DocumentFragment)t.appendChild(i);else for(;i.hasChildNodes();)t.appendChild(i.removeChild(i.firstChild));this.container=t}},s.prototype.allocate=function(t){t=t.toLowerCase(),t in this.detachedNodes||(this.detachedNodes[t]=[]);var i,e=this.detachedNodes[t];return e.length>0?i=e.pop():(i=document.createElement(t),this.container.appendChild(i)),this.nodeCount++,i},s.prototype.deallocate=function(t){var i=t.nodeName.toLowerCase(),e=this.detachedNodes[i];e.push(t),this.nodeCount--},s.prototype.getNodeCount=function(){return this.nodeCount},e.exports=s}),define("famous/utilities/Utility",["require","exports","module"],function(t,i,e){var s={};s.Direction={X:0,Y:1,Z:2},s.after=function(t,i){var e=t;return function(){e--,0===e&&i.apply(this,arguments)}},s.loadURL=function(t,i){var e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&i&&i(this.responseText)},e.open("GET",t),e.send()},s.createDocumentFragmentFromHTML=function(t){var i=document.createElement("div");i.innerHTML=t;for(var e=document.createDocumentFragment();i.hasChildNodes();)e.appendChild(i.firstChild);return e},e.exports=s}),define("famous/transitions/MultipleTransition",["require","exports","module","famous/utilities/Utility"],function(t,i,e){function s(t){this.method=t,this._instances=[],this.state=[]}var o=t("famous/utilities/Utility");s.SUPPORTS_MULTIPLE=!0,s.prototype.get=function(){for(var t=0;t=t?2*t*t:-2*t*t+4*t-1},easeOutBounce:function(t){return t*(3-2*t)},spring:function(t){return(1-t)*Math.sin(6*Math.PI*t)+t}},s.SUPPORTS_MULTIPLE=!0,s.DEFAULT_OPTIONS={curve:s.Curves.linear,duration:500,speed:0};var u={};s.registerCurve=function(t,i){return u[t]?!1:(u[t]=i,!0)},s.unregisterCurve=function(t){return u[t]?(delete u[t],!0):!1},s.getCurve=function(t){var i=u[t];if(void 0!==i)return i;throw Error("curve not registered")},s.getCurves=function(){return u},s.prototype.setOptions=function(t){void 0!==t.curve&&(this.options.curve=t.curve),void 0!==t.duration&&(this.options.duration=t.duration),void 0!==t.speed&&(this.options.speed=t.speed)},s.prototype.set=function(t,i,e){if(!i)return this.reset(t),void(e&&e());if(this._startValue=n(this.get()),i=r(i,this.options),i.speed){var s=this._startValue;if(s instanceof Object){var o=0;for(var a in s)o+=(t[a]-s[a])*(t[a]-s[a]);i.duration=Math.sqrt(o)/i.speed}else i.duration=Math.abs(t-s)/i.speed}this._startTime=Date.now(),this._endValue=n(t),this._startVelocity=n(i.velocity),this._duration=i.duration,this._curve=i.curve,this._active=!0,this._callback=e},s.prototype.reset=function(t,i){if(this._callback){var e=this._callback;this._callback=void 0,e()}this.state=n(t),this.velocity=n(i),this._startTime=0,this._duration=0,this._updateTime=0,this._startValue=this.state,this._startVelocity=this.velocity,this._endValue=this.state,this._active=!1},s.prototype.getVelocity=function(){return this.velocity},s.prototype.get=function(t){return this.update(t),this.state},s.prototype.update=function(t){if(this._active){if(t||(t=Date.now()),!(this._updateTime>=t)){this._updateTime=t;var i=t-this._startTime;if(i>=this._duration)this.state=this._endValue,this.velocity=a(this.state,this._startValue,this._curve,this._duration,1),this._active=!1;else if(0>i)this.state=this._startValue,this.velocity=this._startVelocity;else{var e=i/this._duration;this.state=h(this._startValue,this._endValue,this._curve(e)),this.velocity=a(this.state,this._startValue,this._curve,this._duration,e)}}}else if(this._callback){var s=this._callback;this._callback=void 0,s()}},s.prototype.isActive=function(){return this._active},s.prototype.halt=function(){this.reset(this.get())},s.registerCurve("linear",s.Curves.linear),s.registerCurve("easeIn",s.Curves.easeIn),s.registerCurve("easeOut",s.Curves.easeOut),s.registerCurve("easeInOut",s.Curves.easeInOut),s.registerCurve("easeOutBounce",s.Curves.easeOutBounce),s.registerCurve("spring",s.Curves.spring),s.customCurve=function(t,i){return t=t||0,i=i||0,function(e){return t*e+(-2*t-i+3)*e*e+(t+i-2)*e*e*e}},e.exports=s}),define("famous/transitions/Transitionable",["require","exports","module","./MultipleTransition","./TweenTransition"],function(t,i,e){function s(t){this.currentAction=null,this.actionQueue=[],this.callbackQueue=[],this.state=0,this.velocity=void 0,this._callback=void 0,this._engineInstance=null,this._currentMethod=null,this.set(t)}function o(){if(this._callback){var t=this._callback;this._callback=void 0,t()}if(this.actionQueue.length<=0)return void this.set(this.get());this.currentAction=this.actionQueue.shift(),this._callback=this.callbackQueue.shift();var i=null,e=this.currentAction[0],s=this.currentAction[1];s instanceof Object&&s.method?(i=s.method,"string"==typeof i&&(i=a[i])):i=r,this._currentMethod!==i&&(this._engineInstance=!(e instanceof Object)||i.SUPPORTS_MULTIPLE===!0||e.length<=i.SUPPORTS_MULTIPLE?new i:new n(i),this._currentMethod=i),this._engineInstance.reset(this.state,this.velocity),void 0!==this.velocity&&(s.velocity=this.velocity),this._engineInstance.set(e,s,o.bind(this))}var n=t("./MultipleTransition"),r=t("./TweenTransition"),a={};s.registerMethod=function(t,i){return t in a?!1:(a[t]=i,!0)},s.unregisterMethod=function(t){return t in a?(delete a[t],!0):!1},s.prototype.set=function(t,i,e){if(!i)return this.reset(t),e&&e(),this;var s=[t,i];return this.actionQueue.push(s),this.callbackQueue.push(e),this.currentAction||o.call(this),this},s.prototype.reset=function(t,i){this._currentMethod=null,this._engineInstance=null,this._callback=void 0,this.state=t,this.velocity=i,this.currentAction=null,this.actionQueue=[],this.callbackQueue=[]},s.prototype.delay=function(t,i){this.set(this.get(),{duration:t,curve:function(){return 0}},i)},s.prototype.get=function(t){return this._engineInstance&&(this._engineInstance.getVelocity&&(this.velocity=this._engineInstance.getVelocity()),this.state=this._engineInstance.get(t)),this.state},s.prototype.isActive=function(){return!!this.currentAction},s.prototype.halt=function(){this.set(this.get())},e.exports=s}),define("famous/core/Context",["require","exports","module","./RenderNode","./EventHandler","./ElementAllocator","./Transform","famous/transitions/Transitionable"],function(t,i,e){function s(t){return[t.clientWidth,t.clientHeight]}function o(t){this.container=t,this._allocator=new a(t),this._node=new n,this._eventOutput=new r,this._size=s(this.container),this._perspectiveState=new u(0),this._perspective=void 0,this._nodeContext={allocator:this._allocator,transform:h.identity,opacity:1,origin:c,align:null,size:this._size},this._eventOutput.on("resize",function(){this.setSize(s(this.container))}.bind(this))}var n=t("./RenderNode"),r=t("./EventHandler"),a=t("./ElementAllocator"),h=t("./Transform"),u=t("famous/transitions/Transitionable"),c=[0,0];o.prototype.getAllocator=function(){return this._allocator},o.prototype.add=function(t){return this._node.add(t)},o.prototype.migrate=function(t){t!==this.container&&(this.container=t,this._allocator.migrate(t))},o.prototype.getSize=function(){return this._size},o.prototype.setSize=function(t){t||(t=s(this.container)),this._size[0]=t[0],this._size[1]=t[1]},o.prototype.update=function(t){t&&(t.transform&&(this._nodeContext.transform=t.transform),t.opacity&&(this._nodeContext.opacity=t.opacity),t.origin&&(this._nodeContext.origin=t.origin),t.align&&(this._nodeContext.align=t.align),t.size&&(this._nodeContext.size=t.size));var i=this._perspectiveState.get();i!==this._perspective&&(this.container.style.perspective=i?i.toFixed()+"px":"",this.container.style.webkitPerspective=i?i.toFixed():"",this._perspective=i),this._node.commit(this._nodeContext)},o.prototype.getPerspective=function(){return this._perspectiveState.get()},o.prototype.setPerspective=function(t,i,e){return this._perspectiveState.set(t,i,e)},o.prototype.emit=function(t,i){return this._eventOutput.emit(t,i)},o.prototype.on=function(t,i){return this._eventOutput.on(t,i)},o.prototype.removeListener=function(t,i){return this._eventOutput.removeListener(t,i)},o.prototype.pipe=function(t){return this._eventOutput.pipe(t)},o.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)},e.exports=o}),define("famous/core/OptionsManager",["require","exports","module","./EventHandler"],function(t,i,e){function s(t){this._value=t,this.eventOutput=null}function o(){this.eventOutput=new n,this.eventOutput.bindThis(this),n.setOutputHandler(this,this.eventOutput)}var n=t("./EventHandler");s.patch=function(t){for(var i=new s(t),e=1;et-d)){var i=0;for(n=t-d,d=t,_.emit("prerender"),i=0;ie;e++)i+=t[e]<1e-6&&t[e]>-1e-6?"0,":t[e]+",";return i+=t[15]+")"}function c(t){return 100*t[0]+"% "+100*t[1]+"%"}function p(t,i){return t&&i?t[0]!==i[0]||t[1]!==i[1]:t!==i}var l=t("./Entity"),f=t("./EventHandler"),d=t("./Transform"),m=window.devicePixelRatio||1,y=void 0!==document.createElement("div").style.webkitTransform;s.prototype.elementType="div",s.prototype.elementClass="famous-surface",s.prototype.on=function(t,i){this._currTarget&&this._currTarget.addEventListener(t,this.eventForwarder),this.eventHandler.on(t,i)},s.prototype.removeListener=function(t,i){this.eventHandler.removeListener(t,i)},s.prototype.emit=function(t,i){i&&!i.origin&&(i.origin=this);var e=this.eventHandler.emit(t,i);return e&&i&&i.stopPropagation&&i.stopPropagation(),e},s.prototype.pipe=function(t){return this.eventHandler.pipe(t)},s.prototype.unpipe=function(t){return this.eventHandler.unpipe(t)},s.prototype.render=function(){return this.id},s.prototype.setProperties=function(t){for(var i in t)this.properties[i]=t[i];this._stylesDirty=!0},s.prototype.getProperties=function(){return this.properties},s.prototype.addClass=function(t){this.classList.indexOf(t)<0&&(this.classList.push(t),this._classesDirty=!0)},s.prototype.removeClass=function(t){var i=this.classList.indexOf(t);i>=0&&(this._dirtyClasses.push(this.classList.splice(i,1)[0]),this._classesDirty=!0)},s.prototype.setClasses=function(t){var i=0,e=[];for(i=0;i-1?function(t,i){t.style.zIndex=1e6*i[14]|0,t.style.transform=u(i)}:y?function(t,i){t.style.webkitTransform=u(i)}:function(t,i){t.style.transform=u(i)};var g=y?function(t,i){t.style.webkitTransformOrigin=c(i)}:function(t,i){t.style.transformOrigin=c(i)},v=y?function(t){t.style.webkitTransform="scale3d(0.0001,0.0001,1)",t.style.opacity=0}:function(t){t.style.transform="scale3d(0.0001,0.0001,1)",t.style.opacity=0};s.prototype.setup=function(t){var i=t.allocate(this.elementType);if(this.elementClass)if(this.elementClass instanceof Array)for(var e=0;e=1?"0.999999":s),p(this._origin,o)||d.notEquals(this._matrix,e)||this._sizeDirty){e||(e=d.identity),this._matrix=e;var l=e;o&&(this._origin||(this._origin=[0,0]),this._origin[0]=o[0],this._origin[1]=o[1],l=d.thenMove(e,[-this._size[0]*o[0],-this._size[1]*o[1],0]),g(i,o)),_(i,l)}this._sizeDirty&&(this._size&&(i.style.width=this.size&&this.size[0]===!0?"":this._size[0]+"px",i.style.height=this.size&&this.size[1]===!0?"":this._size[1]+"px"),this._sizeDirty=!1)},s.prototype.cleanup=function(t){var i=0,e=this._currTarget; +this.eventHandler.emit("recall"),this.recall(e),e.style.display="none",e.style.width="",e.style.height="",this._size=null,h.call(this,e);var s=this.getClassList();for(r.call(this,e),i=0;ii||i>=this.array.length?null:this.array[i]},s.Backing.prototype.setValue=function(t,i){this.array[t-this.firstIndex]=i},s.Backing.prototype.reindex=function(t,i,e){if(this.array[0]){for(var s=0,o=this.firstIndex,n=e-i,r=this.firstNode;t-1>o;)r=r.getNext(),o++;var a=r;for(s=0;i>s;s++)r=r.getNext(),r&&(r._previousNode=a);var h=r?r.getNext():null;for(a._nextNode=null,r=a,s=0;e>s;s++)r=r.getNext();if(o+=e,r!==h&&(r._nextNode=h,h&&(h._previousNode=r)),h)for(r=h,o++;r&&o1e-7?r.call(h,this.mult(t/i)):o.call(h,t,0,0)},s.prototype.clone=function(){return new s(this)},s.prototype.isZero=function(){return!(this.x||this.y||this.z)},s.prototype.set=function(t){return t instanceof Array?n.call(this,t):t instanceof s?r.call(this,t):"number"==typeof t?a.call(this,t):void 0},s.prototype.setXYZ=function(){return o.apply(this,arguments)},s.prototype.set1D=function(t){return a.call(this,t)},s.prototype.put=function(t){r.call(t,h)},s.prototype.clear=function(){return o.call(this,0,0,0)},s.prototype.cap=function u(u){if(1/0===u)return r.call(h,this);var t=this.norm();return t>u?r.call(h,this.mult(u/t)):r.call(h,this)},s.prototype.project=function(t){return t.mult(this.dot(t))},s.prototype.reflectAcross=function(t){return t.normalize().put(t),r(h,this.sub(this.project(t).mult(2)))},s.prototype.get=function(){return[this.x,this.y,this.z]},s.prototype.get1D=function(){return this.x},e.exports=s}),define("famous/math/Matrix",["require","exports","module","./Vector"],function(t,i,e){function s(t){return this.values=t||[[1,0,0],[0,1,0],[0,0,1]],this}var o=t("./Vector"),n=new s,r=new o;s.prototype.get=function(){return this.values},s.prototype.set=function(t){this.values=t},s.prototype.vectorMultiply=function(t){var i=this.get(),e=t.x,s=t.y,o=t.z,n=i[0],a=i[1],h=i[2],u=n[0],c=n[1],p=n[2],l=a[0],f=a[1],d=a[2],m=h[0],y=h[1],_=h[2];return r.setXYZ(u*e+c*s+p*o,l*e+f*s+d*o,m*e+y*s+_*o)},s.prototype.multiply=function(t){for(var i=this.get(),e=[[]],s=0;3>s;s++){e[s]=[];for(var o=0;3>o;o++){for(var r=0,a=0;3>a;a++)r+=i[s][a]*t[a][o];e[s][o]=r}}return n.set(e)},s.prototype.transpose=function(){for(var t=[],i=this.get(),e=0;3>e;e++)for(var s=0;3>s;s++)t[e][s]=i[s][e];return n.set(t)},s.prototype.clone=function(){for(var t=this.get(),i=[],e=0;3>e;e++)i[e]=t[e].slice();return new s(i)},e.exports=s}),define("famous/math/Quaternion",["require","exports","module","./Matrix"],function(t,i,e){function s(t,i,e,s){return 1===arguments.length?this.set(t):(this.w=void 0!==t?t:1,this.x=void 0!==i?i:0,this.y=void 0!==e?e:0,this.z=void 0!==s?s:0),this}var o=t("./Matrix"),n=new s(1,0,0,0);s.prototype.add=function(t){return n.setWXYZ(this.w+t.w,this.x+t.x,this.y+t.y,this.z+t.z)},s.prototype.sub=function(t){return n.setWXYZ(this.w-t.w,this.x-t.x,this.y-t.y,this.z-t.z)},s.prototype.scalarDivide=function(t){return this.scalarMultiply(1/t)},s.prototype.scalarMultiply=function(t){return n.setWXYZ(this.w*t,this.x*t,this.y*t,this.z*t)},s.prototype.multiply=function(t){var i=this.x,e=this.y,s=this.z,o=this.w,r=t.x,a=t.y,h=t.z,u=t.w||0;return n.setWXYZ(o*u-i*r-e*a-s*h,i*u+r*o+a*s-e*h,e*u+a*o+i*h-r*s,s*u+h*o+r*e-i*a)};var r=new s(1,0,0,0);s.prototype.rotateVector=function(t){return r.set(this.conj()),n.set(this.multiply(t).multiply(r))},s.prototype.inverse=function(){return n.set(this.conj().scalarDivide(this.normSquared()))},s.prototype.negate=function(){return this.scalarMultiply(-1)},s.prototype.conj=function(){return n.setWXYZ(this.w,-this.x,-this.y,-this.z)},s.prototype.normalize=function(t){return t=void 0===t?1:t,this.scalarDivide(t*this.norm())},s.prototype.makeFromAngleAndAxis=function(t,i){var e=i.normalize(),s=.5*t,o=-Math.sin(s);return this.x=o*e.x,this.y=o*e.y,this.z=o*e.z,this.w=Math.cos(s),this},s.prototype.setWXYZ=function(t,i,e,s){return n.clear(),this.w=t,this.x=i,this.y=e,this.z=s,this},s.prototype.set=function(t){return t instanceof Array?(this.w=t[0],this.x=t[1],this.y=t[2],this.z=t[3]):(this.w=t.w,this.x=t.x,this.y=t.y,this.z=t.z),this!==n&&n.clear(),this},s.prototype.put=function(t){t.set(n)},s.prototype.clone=function(){return new s(this)},s.prototype.clear=function(){return this.w=1,this.x=0,this.y=0,this.z=0,this},s.prototype.isEqual=function(t){return t.w===this.w&&t.x===this.x&&t.y===this.y&&t.z===this.z},s.prototype.dot=function(t){return this.w*t.w+this.x*t.x+this.y*t.y+this.z*t.z},s.prototype.normSquared=function(){return this.dot(this)},s.prototype.norm=function(){return Math.sqrt(this.normSquared())},s.prototype.isZero=function(){return!(this.x||this.y||this.z)},s.prototype.getTransform=function(){var t=this.normalize(1),i=t.x,e=t.y,s=t.z,o=t.w;return[1-2*e*e-2*s*s,2*i*e-2*s*o,2*i*s+2*e*o,0,2*i*e+2*s*o,1-2*i*i-2*s*s,2*e*s-2*i*o,0,2*i*s-2*e*o,2*e*s+2*i*o,1-2*i*i-2*e*e,0,0,0,0,1]};var a=new o;s.prototype.getMatrix=function(){var t=this.normalize(1),i=t.x,e=t.y,s=t.z,o=t.w;return a.set([[1-2*e*e-2*s*s,2*i*e+2*s*o,2*i*s-2*e*o],[2*i*e-2*s*o,1-2*i*i-2*s*s,2*e*s+2*i*o],[2*i*s+2*e*o,2*e*s-2*i*o,1-2*i*i-2*e*e]])};var h=1e-5;s.prototype.slerp=function(t,i){var e,s,o,r,a;return s=this.dot(t),1-s>h?(e=Math.acos(s),o=Math.sin(e),r=Math.sin((1-i)*e)/o,a=Math.sin(i*e)/o):(r=1-i,a=i),n.set(this.scalarMultiply(r/a).add(t).multiply(a))},e.exports=s}),define("famous/math/Random",["require","exports","module"],function(t,i,e){function s(t,i){return t+n()*(i-t)}function o(t,i){return t+n()*(i-t+1)>>0}var n=Math.random,r={};r.integer=function(t,i,e){if(t=void 0!==t?t:0,i=void 0!==i?i:1,void 0!==e){for(var s=[],n=0;e>n;n++)s.push(o(t,i));return s}return o(t,i)},r.range=function(t,i,e){if(t=void 0!==t?t:0,i=void 0!==i?i:1,void 0!==e){for(var o=[],n=0;e>n;n++)o.push(s(t,i));return o}return s(t,i)},r.sign=function(t){return t=void 0!==t?t:.5,n()n-h){var u=new window.CustomEvent("click",{bubbles:!0,details:a});s[n]=i,i.target.dispatchEvent(u)}delete e[a.identifier]}}),window.addEventListener("click",function(t){var e=o();for(var n in s){var r=s[n];i>e-n?t instanceof window.MouseEvent&&t.target===r.target&&t.stopPropagation():delete s[n]}},!0)}}),define("famous/inputs/GenericSync",["require","exports","module","famous/core/EventHandler"],function(t,i,e){function s(t,i){this._eventInput=new n,this._eventOutput=new n,n.setInputHandler(this,this._eventInput),n.setOutputHandler(this,this._eventOutput),this._syncs={},t&&this.addSync(t),i&&this.setOptions(i)}function o(t,i){r[t]&&(this._syncs[t]=new r[t](i),this.pipeSync(t))}var n=t("famous/core/EventHandler");s.DIRECTION_X=0,s.DIRECTION_Y=1,s.DIRECTION_Z=2;var r={};s.register=function(t){for(var i in t){if(r[i]){if(r[i]===t[i])return;throw Error("this key is registered to a different sync class")}r[i]=t[i]}},s.prototype.setOptions=function(t){for(var i in this._syncs)this._syncs[i].setOptions(t)},s.prototype.pipeSync=function(t){var i=this._syncs[t];this._eventInput.pipe(i),i.pipe(this._eventOutput)},s.prototype.unpipeSync=function(t){var i=this._syncs[t];this._eventInput.unpipe(i),i.unpipe(this._eventOutput)},s.prototype.addSync=function(t){if(t instanceof Array)for(var i=0;iMath.abs(h)?h=0:a=0);var p,l,f=Math.max(r-e,u),d=a/f,m=h/f,y=this.options.scale;this.options.direction===s.DIRECTION_X?(l=y*a,p=y*d,this._position+=l):this.options.direction===s.DIRECTION_Y?(l=y*h,p=y*m,this._position+=l):(l=[y*a,y*h],p=[y*d,y*m],this._position[0]+=l[0],this._position[1]+=l[1]);var _=this._payload;_.delta=l,_.position=this._position,_.velocity=p,_.clientX=o,_.clientY=n,_.offsetX=t.offsetX,_.offsetY=t.offsetY,this._eventOutput.emit("update",_),this._prevCoord=[o,n],this._prevTime=r,this._move=!0}}function r(){this._down&&(this._eventOutput.emit("end",this._payload),this._prevCoord=void 0,this._prevTime=void 0,this._down=!1,this._move=!1)}function a(t){if(this._down&&this._move){var i=n.bind(this),e=function(t){r.call(this,t),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",e)}.bind(this,t);document.addEventListener("mousemove",i),document.addEventListener("mouseup",e)}}var h=t("famous/core/EventHandler");s.DEFAULT_OPTIONS={direction:void 0,rails:!1,scale:1,propogate:!0},s.DIRECTION_X=0,s.DIRECTION_Y=1;var u=8,c=Date.now;s.prototype.getOptions=function(){return this.options},s.prototype.setOptions=function(t){void 0!==t.direction&&(this.options.direction=t.direction),void 0!==t.rails&&(this.options.rails=t.rails),void 0!==t.scale&&(this.options.scale=t.scale),void 0!==t.propogate&&(this.options.propogate=t.propogate)},e.exports=s}),define("famous/inputs/TwoFingerSync",["require","exports","module","famous/core/EventHandler"],function(t,i,e){function s(){this._eventInput=new o,this._eventOutput=new o,o.setInputHandler(this,this._eventInput),o.setOutputHandler(this,this._eventOutput),this.touchAEnabled=!1,this.touchAId=0,this.posA=null,this.timestampA=0,this.touchBEnabled=!1,this.touchBId=0,this.posB=null,this.timestampB=0,this._eventInput.on("touchstart",this.handleStart.bind(this)),this._eventInput.on("touchmove",this.handleMove.bind(this)),this._eventInput.on("touchend",this.handleEnd.bind(this)),this._eventInput.on("touchcancel",this.handleEnd.bind(this))}var o=t("famous/core/EventHandler");s.calculateAngle=function(t,i){var e=i[0]-t[0],s=i[1]-t[1];return Math.atan2(s,e)},s.calculateDistance=function(t,i){var e=i[0]-t[0],s=i[1]-t[1];return Math.sqrt(e*e+s*s)},s.calculateCenter=function(t,i){return[(t[0]+i[0])/2,(t[1]+i[1])/2]};var n=Date.now;s.prototype.handleStart=function(t){for(var i=0;ithis.options.stallTime){this._position=void 0===this.options.direction?[0,0]:0,this._inProgress=!1;var t=Math.abs(this._prevVel)>=this.options.minimumEndSpeed?this._prevVel:0,i=this._payload;i.position=this._position,i.velocity=t,i.slip=!0,this._eventOutput.emit("end",i)}}function n(t){t.preventDefault(),this._inProgress||(this._inProgress=!0,y=this._payload,y.slip=!0,y.position=this._position,y.clientX=t.clientX,y.clientY=t.clientY,y.offsetX=t.offsetX,y.offsetY=t.offsetY,this._eventOutput.emit("start",y),this._loopBound||(a.on("prerender",o.bind(this)),this._loopBound=!0));var i=u(),e=this._prevTime||i,n=void 0!==t.wheelDeltaX?t.wheelDeltaX:-t.deltaX,r=void 0!==t.wheelDeltaY?t.wheelDeltaY:-t.deltaY;1===t.deltaMode&&(n*=this.options.lineHeight,r*=this.options.lineHeight),this.options.rails&&(Math.abs(n)>Math.abs(r)?r=0:n=0);var c,p,l=Math.max(i-e,h),f=n/l,d=r/l,m=this.options.scale;this.options.direction===s.DIRECTION_X?(p=m*n,c=m*f,this._position+=p):this.options.direction===s.DIRECTION_Y?(p=m*r,c=m*d,this._position+=p):(p=[m*n,m*r],c=[m*f,m*d],this._position[0]+=p[0],this._position[1]+=p[1]);var y=this._payload;y.delta=p,y.velocity=c,y.position=this._position,y.slip=!0,this._eventOutput.emit("update",y),this._prevTime=i,this._prevVel=c}var r=t("famous/core/EventHandler"),a=t("famous/core/Engine");s.DEFAULT_OPTIONS={direction:void 0,minimumEndSpeed:1/0,rails:!1,scale:1,stallTime:50,lineHeight:40},s.DIRECTION_X=0,s.DIRECTION_Y=1;var h=8,u=Date.now;s.prototype.getOptions=function(){return this.options},s.prototype.setOptions=function(t){void 0!==t.direction&&(this.options.direction=t.direction),void 0!==t.minimumEndSpeed&&(this.options.minimumEndSpeed=t.minimumEndSpeed),void 0!==t.rails&&(this.options.rails=t.rails),void 0!==t.scale&&(this.options.scale=t.scale),void 0!==t.stallTime&&(this.options.stallTime=t.stallTime)},e.exports=s}),define("famous/inputs/TouchTracker",["require","exports","module","famous/core/EventHandler"],function(t,i,e){function s(t,i,e){return{x:t.clientX,y:t.clientY,identifier:t.identifier,origin:i.origin,timestamp:c(),count:i.touches.length,history:e}}function o(t){for(var i=0;iMath.abs(h)?h=0:a=0);var c,p,l=Math.max(r-n,u),f=a/l,d=h/l,m=this.options.scale;this.options.direction===s.DIRECTION_X?(p=m*a,c=m*f,this._position+=p):this.options.direction===s.DIRECTION_Y?(p=m*h,c=m*d,this._position+=p):(p=[m*a,m*h],c=[m*f,m*d],this._position[0]+=p[0],this._position[1]+=p[1]);var y=this._payload;y.delta=p,y.velocity=c,y.position=this._position,y.clientX=t.x,y.clientY=t.y,y.count=t.count,y.touch=t.identifier,this._eventOutput.emit("update",y)}function r(t){this._payload.count=t.count,this._eventOutput.emit("end",this._payload)}var a=t("./TouchTracker"),h=t("famous/core/EventHandler");s.DEFAULT_OPTIONS={direction:void 0,rails:!1,scale:1},s.DIRECTION_X=0,s.DIRECTION_Y=1;var u=8;s.prototype.setOptions=function(t){void 0!==t.direction&&(this.options.direction=t.direction),void 0!==t.rails&&(this.options.rails=t.rails),void 0!==t.scale&&(this.options.scale=t.scale)},s.prototype.getOptions=function(){return this.options},e.exports=s}),define("famous/modifiers/Draggable",["require","exports","module","famous/core/Transform","famous/transitions/Transitionable","famous/core/EventHandler","famous/math/Utilities","famous/inputs/GenericSync","famous/inputs/MouseSync","famous/inputs/TouchSync"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),t&&this.setOptions(t),this._positionState=new c([0,0]),this._differential=[0,0],this._active=!0,this.sync=new f(["mouse","touch"],{scale:this.options.scale}),this.eventOutput=new p,p.setInputHandler(this,this.sync),p.setOutputHandler(this,this.eventOutput),h.call(this)}function o(t){var i=this.options,e=i.projection,s=i.snapX,o=i.snapY,n=e&y.x?t[0]:0,r=e&y.y?t[1]:0;return s>0&&(n-=n%s),o>0&&(r-=r%o),[n,r]}function n(){this._active&&(this._positionState.isActive()&&this._positionState.halt(),this.eventOutput.emit("start",{position:this.getPosition()}))}function r(t){if(this._active){var i=this.options;this._differential=t.position;var e=o.call(this,this._differential);this._differential[0]-=e[0],this._differential[1]-=e[1];var s=this.getPosition();if(s[0]+=e[0],s[1]+=e[1],i.xRange){var n=[i.xRange[0]+.5*i.snapX,i.xRange[1]-.5*i.snapX];s[0]=_(s[0],n)}if(i.yRange){var r=[i.yRange[0]+.5*i.snapY,i.yRange[1]-.5*i.snapY];s[1]=_(s[1],r)}this.eventOutput.emit("update",{position:s})}}function a(){this._active&&this.eventOutput.emit("end",{position:this.getPosition()})}function h(){this.sync.on("start",n.bind(this)),this.sync.on("update",r.bind(this)),this.sync.on("end",a.bind(this))}var u=t("famous/core/Transform"),c=t("famous/transitions/Transitionable"),p=t("famous/core/EventHandler"),l=t("famous/math/Utilities"),f=t("famous/inputs/GenericSync"),d=t("famous/inputs/MouseSync"),m=t("famous/inputs/TouchSync");f.register({mouse:d,touch:m});var y={x:1,y:2};s.DIRECTION_X=y.x,s.DIRECTION_Y=y.y;var _=l.clamp;s.DEFAULT_OPTIONS={projection:y.x|y.y,scale:1,xRange:null,yRange:null,snapX:0,snapY:0,transition:{duration:0}},s.prototype.setOptions=function(t){var i=this.options;if(void 0!==t.projection){var e=t.projection;this.options.projection=0,["x","y"].forEach(function(t){-1!==e.indexOf(t)&&(i.projection|=y[t])})}void 0!==t.scale&&(i.scale=t.scale,this.sync.setOptions({scale:t.scale})),void 0!==t.xRange&&(i.xRange=t.xRange),void 0!==t.yRange&&(i.yRange=t.yRange),void 0!==t.snapX&&(i.snapX=t.snapX),void 0!==t.snapY&&(i.snapY=t.snapY)},s.prototype.getPosition=function(){return this._positionState.get()},s.prototype.setRelativePosition=function(t,i,e){var s=this.getPosition(),o=[s[0]+t[0],s[1]+t[1]];this.setPosition(o,i,e)},s.prototype.setPosition=function(t,i,e){this._positionState.isActive()&&this._positionState.halt(),this._positionState.set(t,i,e)},s.prototype.activate=function(){this._active=!0},s.prototype.deactivate=function(){this._active=!1},s.prototype.toggle=function(){this._active=!this._active},s.prototype.modify=function(t){var i=this.getPosition();return{transform:u.translate(i[0],i[1]),target:t}},e.exports=s}),define("famous/modifiers/Fader",["require","exports","module","famous/transitions/Transitionable","famous/core/OptionsManager"],function(t,i,e){function s(t,i){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new n(this.options),t&&this.setOptions(t),i||(i=0),this.transitionHelper=new o(i)}var o=t("famous/transitions/Transitionable"),n=t("famous/core/OptionsManager");s.DEFAULT_OPTIONS={cull:!1,transition:!0,pulseInTransition:!0,pulseOutTransition:!0},s.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},s.prototype.show=function(t,i){t=t||this.options.transition,this.set(1,t,i)},s.prototype.hide=function(t,i){t=t||this.options.transition,this.set(0,t,i)},s.prototype.set=function(t,i,e){this.halt(),this.transitionHelper.set(t,i,e)},s.prototype.halt=function(){this.transitionHelper.halt()},s.prototype.isVisible=function(){return this.transitionHelper.get()>0},s.prototype.modify=function(t){var i=this.transitionHelper.get();return this.options.cull&&!i?void 0:{opacity:i,target:t}},e.exports=s}),define("famous/modifiers/ModifierChain",["require","exports","module"],function(t,i,e){function s(){this._chain=[],arguments.length&&this.addModifier.apply(this,arguments)}s.prototype.addModifier=function(){Array.prototype.push.apply(this._chain,arguments)},s.prototype.removeModifier=function(t){var i=this._chain.indexOf(t);0>i||this._chain.splice(i,1)},s.prototype.modify=function(t){for(var i=this._chain,e=t,s=0;s-1;t--)a.call(this,t)}function u(t,i){var e=this._agents[this._constraints[t]];return e.agent.applyConstraint(e.targets,e.source,i)}function c(t){for(var i=0;i-1;e--)u.call(this,e,t);i++}}function p(t,i){t.integrateVelocity(i)}function l(t,i){t.integrateAngularMomentum(i),t.updateAngularVelocity()}function f(t,i){t.integrateOrientation(i)}function d(t,i){t.integratePosition(i),t.emit("update",t)}function m(t){h.call(this,t),this.forEach(p,t),this.forEachBody(l,t),c.call(this,t),this.forEachBody(f,t),this.forEach(d,t)}function y(){var t=0,i=0;return this.forEach(function(e){i=e.getEnergy(),t+=i,i-1;i--)t+=this._forces[i].getEnergy()||0;return t}function g(){for(var t=0,i=this._constraints.length-1;i>-1;i--)t+=this._constraints[i].getEnergy()||0;return t}var v=t("famous/core/EventHandler"),O=17,T=1e3/120,S=17;s.DEFAULT_OPTIONS={constraintSteps:1,sleepTolerance:1e-7};var w=function(){return Date.now}();s.prototype.setOptions=function(t){for(var i in t)this.options[i]&&(this.options[i]=t[i])},s.prototype.addBody=function(t){return t._engine=this,t.isBody?(this._bodies.push(t),this._hasBodies=!0):this._particles.push(t),t},s.prototype.removeBody=function(t){var i=t.isBody?this._bodies:this._particles,e=i.indexOf(t);if(e>-1){for(var s=0;s-1&&s.splice(o,1)}},s.prototype.detachAll=function(){this._agents={},this._forces=[],this._constraints=[],this._currAgentId=0},s.prototype.getAgent=function(t){return r.call(this,t).agent},s.prototype.getParticles=function(){return this._particles},s.prototype.getBodies=function(){return this._bodies},s.prototype.getParticlesAndBodies=function(){return this.getParticles().concat(this.getBodies())},s.prototype.forEachParticle=function(t,i){for(var e=this.getParticles(),s=0,o=e.length;o>s;s++)t.call(this,e[s],i)},s.prototype.forEachBody=function(t,i){if(this._hasBodies)for(var e=this.getBodies(),s=0,o=e.length;o>s;s++)t.call(this,e[s],i)},s.prototype.forEach=function(t,i){this.forEachParticle(t,i),this.forEachBody(t,i)},s.prototype.getEnergy=function(){return y.call(this)+_.call(this)+g.call(this)},s.prototype.step=function(){var t=w(),i=t-this._prevTime;this._prevTime=t,T>i||(i>S&&(i=S),m.call(this,O))},s.prototype.isSleeping=function(){return this._isSleeping},s.prototype.sleep=function(){this.emit("end",this),this._isSleeping=!0},s.prototype.wake=function(){this._prevTime=w(),this.emit("start",this),this._isSleeping=!1},s.prototype.emit=function(t,i){null!==this._eventHandler&&this._eventHandler.emit(t,i)},s.prototype.on=function(t,i){null===this._eventHandler&&(this._eventHandler=new v),this._eventHandler.on(t,i)},e.exports=s}),define("famous/surfaces/CanvasSurface",["require","exports","module","famous/core/Surface"],function(t,i,e){function s(t){t&&t.canvasSize&&(this._canvasSize=t.canvasSize),o.apply(this,arguments),this._canvasSize||(this._canvasSize=this.getSize()),this._backBuffer=document.createElement("canvas"),this._canvasSize&&(this._backBuffer.width=this._canvasSize[0],this._backBuffer.height=this._canvasSize[1]),this._contextId=void 0}var o=t("famous/core/Surface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="canvas",s.prototype.elementClass="famous-surface",s.prototype.setContent=function(){},s.prototype.deploy=function(t){this._canvasSize&&(t.width=this._canvasSize[0],t.height=this._canvasSize[1]),"2d"===this._contextId&&(t.getContext(this._contextId).drawImage(this._backBuffer,0,0),this._backBuffer.width=0,this._backBuffer.height=0)},s.prototype.recall=function(t){this.getSize();this._backBuffer.width=t.width,this._backBuffer.height=t.height,"2d"===this._contextId&&(this._backBuffer.getContext(this._contextId).drawImage(t,0,0),t.width=0,t.height=0)},s.prototype.getContext=function(t){return this._contextId=t,this._currTarget?this._currTarget.getContext(t):this._backBuffer.getContext(t)},s.prototype.setSize=function(t,i){o.prototype.setSize.apply(this,arguments),i&&(this._canvasSize=[i[0],i[1]]),this._currTarget&&(this._currTarget.width=this._canvasSize[0],this._currTarget.height=this._canvasSize[1])},e.exports=s}),define("famous/surfaces/ContainerSurface",["require","exports","module","famous/core/Surface","famous/core/Context"],function(t,i,e){function s(t){o.call(this,t),this._container=document.createElement("div"),this._container.classList.add("famous-group"),this._container.classList.add("famous-container-group"),this._shouldRecalculateSize=!1,this.context=new n(this._container),this.setContent(this._container)}var o=t("famous/core/Surface"),n=t("famous/core/Context");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="div",s.prototype.elementClass="famous-surface",s.prototype.add=function(){return this.context.add.apply(this.context,arguments)},s.prototype.render=function(){return this._sizeDirty&&(this._shouldRecalculateSize=!0),o.prototype.render.apply(this,arguments)},s.prototype.deploy=function(){return this._shouldRecalculateSize=!0,o.prototype.deploy.apply(this,arguments)},s.prototype.commit=function(){var t=this._size?[this._size[0],this._size[1]]:null,i=o.prototype.commit.apply(this,arguments);return(this._shouldRecalculateSize||t&&(this._size[0]!==t[0]||this._size[1]!==t[1]))&&(this.context.setSize(),this._shouldRecalculateSize=!1),this.context.update(),i},e.exports=s}),define("famous/surfaces/FormContainerSurface",["require","exports","module","./ContainerSurface"],function(t,i,e){function s(t){t&&(this._method=t.method||""),o.apply(this,arguments)}var o=t("./ContainerSurface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="form",s.prototype.deploy=function(t){return this._method&&(t.method=this._method),o.prototype.deploy.apply(this,arguments)},e.exports=s}),define("famous/surfaces/ImageSurface",["require","exports","module","famous/core/Surface"],function(t,i,e){function s(){this._imageUrl=void 0,o.apply(this,arguments)}var o=t("famous/core/Surface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="img",s.prototype.elementClass="famous-surface",s.prototype.setContent=function(t){this._imageUrl=t,this._contentDirty=!0},s.prototype.deploy=function(t){t.src=this._imageUrl||""},s.prototype.recall=function(t){t.src=""},e.exports=s}),define("famous/surfaces/InputSurface",["require","exports","module","famous/core/Surface"],function(t,i,e){function s(t){this._placeholder=t.placeholder||"",this._value=t.value||"",this._type=t.type||"text",this._name=t.name||"",o.apply(this,arguments),this.on("click",this.focus.bind(this)),window.addEventListener("click",function(t){t.target!==this._currTarget&&this.blur()}.bind(this))}var o=t("famous/core/Surface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="input",s.prototype.elementClass="famous-surface",s.prototype.setPlaceholder=function(t){return this._placeholder=t,this._contentDirty=!0,this},s.prototype.focus=function(){return this._currTarget&&this._currTarget.focus(),this},s.prototype.blur=function(){return this._currTarget&&this._currTarget.blur(),this},s.prototype.setValue=function(t){return this._value=t,this._contentDirty=!0,this},s.prototype.setType=function(t){return this._type=t,this._contentDirty=!0,this},s.prototype.getValue=function(){return this._currTarget?this._currTarget.value:this._value},s.prototype.setName=function(t){return this._name=t,this._contentDirty=!0,this},s.prototype.getName=function(){return this._name},s.prototype.deploy=function(t){""!==this._placeholder&&(t.placeholder=this._placeholder),t.value=this._value,t.type=this._type,t.name=this._name},e.exports=s}),define("famous/surfaces/SubmitInputSurface",["require","exports","module","./InputSurface"],function(t,i,e){function s(t){o.apply(this,arguments),this._type="submit",t&&t.onClick&&this.setOnClick(t.onClick)}var o=t("./InputSurface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.setOnClick=function(t){this.onClick=t},s.prototype.deploy=function(t){this.onclick&&(t.onClick=this.onClick),o.prototype.deploy.apply(this,arguments)},e.exports=s}),define("famous/surfaces/TextareaSurface",["require","exports","module","famous/core/Surface"],function(t,i,e){function s(t){this._placeholder=t.placeholder||"",this._value=t.value||"",this._name=t.name||"",this._wrap=t.wrap||"",this._cols=t.cols||"",this._rows=t.rows||"",o.apply(this,arguments),this.on("click",this.focus.bind(this))}var o=t("famous/core/Surface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.elementType="textarea",s.prototype.elementClass="famous-surface",s.prototype.setPlaceholder=function(t){return this._placeholder=t,this._contentDirty=!0,this},s.prototype.focus=function(){return this._currTarget&&this._currTarget.focus(),this},s.prototype.blur=function(){return this._currTarget&&this._currTarget.blur(),this},s.prototype.setValue=function(t){return this._value=t,this._contentDirty=!0,this},s.prototype.getValue=function(){return this._currTarget?this._currTarget.value:this._value},s.prototype.setName=function(t){return this._name=t,this._contentDirty=!0,this},s.prototype.getName=function(){return this._name},s.prototype.setWrap=function(t){return this._wrap=t,this._contentDirty=!0,this},s.prototype.setColumns=function(t){return this._cols=t,this._contentDirty=!0,this},s.prototype.setRows=function(t){return this._rows=t,this._contentDirty=!0,this},s.prototype.deploy=function(t){""!==this._placeholder&&(t.placeholder=this._placeholder),""!==this._value&&(t.value=this._value),""!==this._name&&(t.name=this._name),""!==this._wrap&&(t.wrap=this._wrap),""!==this._cols&&(t.cols=this._cols),""!==this._rows&&(t.rows=this._rows)},e.exports=s}),define("famous/surfaces/VideoSurface",["require","exports","module","famous/core/Surface"],function(t,i,e){function s(t){this._videoUrl=void 0,this.options=Object.create(s.DEFAULT_OPTIONS),t&&this.setOptions(t),o.apply(this,arguments)}var o=t("famous/core/Surface");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS={autoplay:!1},s.prototype.elementType="video",s.prototype.elementClass="famous-surface",s.prototype.setOptions=function(t){for(var i in s.DEFAULT_OPTIONS)void 0!==t[i]&&(this.options[i]=t[i])},s.prototype.setContent=function(t){this._videoUrl=t,this._contentDirty=!0},s.prototype.deploy=function(t){t.src=this._videoUrl,t.autoplay=this.options.autoplay},s.prototype.recall=function(t){t.src=""},e.exports=s}),define("famous/transitions/CachedMap",["require","exports","module"],function(t,i,e){function s(t){this._map=t||null,this._cachedOutput=null,this._cachedInput=Number.NaN}s.create=function(t){var i=new s(t);return i.get.bind(i)},s.prototype.get=function(t){return t!==this._cachedInput&&(this._cachedInput=t,this._cachedOutput=this._map(t)),this._cachedOutput},e.exports=s}),define("famous/transitions/Easing",["require","exports","module"],function(t,i,e){var s={inQuad:function(t){return t*t},outQuad:function(t){return-(t-=1)*t+1},inOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},inCubic:function(t){return t*t*t},outCubic:function(t){return--t*t*t+1},inOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},inQuart:function(t){return t*t*t*t},outQuart:function(t){return-(--t*t*t*t-1)},inOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},inQuint:function(t){return t*t*t*t*t},outQuint:function(t){return--t*t*t*t*t+1},inOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},inSine:function(t){return-1*Math.cos(t*(Math.PI/2))+1},outSine:function(t){return Math.sin(t*(Math.PI/2))},inOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},inExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},outExpo:function(t){return 1===t?1:-Math.pow(2,-10*t)+1},inOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},inCirc:function(t){return-(Math.sqrt(1-t*t)-1)},outCirc:function(t){return Math.sqrt(1- --t*t)},inOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},inElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1===t?1:(e||(e=.3),i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e)))},outElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1===t?1:(e||(e=.3),i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(t-i)*Math.PI/e)+1)},inOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2===(t/=.5)?1:(e||(e=.3*1.5),i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e)*.5+1)},inBack:function(t,i){return void 0===i&&(i=1.70158),t*t*((i+1)*t-i)},outBack:function(t,i){return void 0===i&&(i=1.70158),--t*t*((i+1)*t+i)+1},inOutBack:function(t,i){return void 0===i&&(i=1.70158),(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},inBounce:function(t){return 1-s.outBounce(1-t)},outBounce:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},inOutBounce:function(t){return.5>t?.5*s.inBounce(2*t):.5*s.outBounce(2*t-1)+.5}};e.exports=s}),define("famous/physics/integrators/SymplecticEuler",["require","exports","module","famous/core/OptionsManager"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new o(this.options),t&&this.setOptions(t)}var o=t("famous/core/OptionsManager");s.DEFAULT_OPTIONS={velocityCap:void 0,angularVelocityCap:void 0},s.prototype.setOptions=function(t){this._optionsManager.patch(t)},s.prototype.getOptions=function(){return this._optionsManager.value()},s.prototype.integrateVelocity=function(t,i){var e=t.velocity,s=t.inverseMass,o=t.force;o.isZero()||(e.add(o.mult(i*s)).put(e),o.clear())},s.prototype.integratePosition=function(t,i){var e=t.position,s=t.velocity;this.options.velocityCap&&s.cap(this.options.velocityCap).put(s),e.add(s.mult(i)).put(e)},s.prototype.integrateAngularMomentum=function(t,i){var e=t.angularMomentum,s=t.torque;s.isZero()||(this.options.angularVelocityCap&&s.cap(this.options.angularVelocityCap).put(s),e.add(s.mult(i)).put(e),s.clear())},s.prototype.integrateOrientation=function(t,i){var e=t.orientation,s=t.angularVelocity; +s.isZero()||e.add(e.multiply(s).scalarMultiply(.5*i)).put(e)},e.exports=s}),define("famous/physics/bodies/Particle",["require","exports","module","famous/math/Vector","famous/core/Transform","famous/core/EventHandler","../integrators/SymplecticEuler"],function(t,i,e){function s(t){t=t||{},this.position=new n,this.velocity=new n,this.force=new n;var i=s.DEFAULT_OPTIONS;this.setPosition(t.position||i.position),this.setVelocity(t.velocity||i.velocity),this.force.set(t.force||[0,0,0]),this.mass=void 0!==t.mass?t.mass:i.mass,this.axis=void 0!==t.axis?t.axis:i.axis,this.inverseMass=1/this.mass,this._isSleeping=!1,this._engine=null,this._eventOutput=null,this._positionGetter=null,this.transform=r.identity.slice(),this._spec={transform:this.transform,target:null}}function o(){this._eventOutput=new a,this._eventOutput.bindThis(this),a.setOutputHandler(this,this._eventOutput)}var n=t("famous/math/Vector"),r=t("famous/core/Transform"),a=t("famous/core/EventHandler"),h=t("../integrators/SymplecticEuler");s.DEFAULT_OPTIONS={position:[0,0,0],velocity:[0,0,0],mass:1,axis:void 0},s.SLEEP_TOLERANCE=1e-7,s.AXES={X:0,Y:1,Z:2},s.INTEGRATOR=new h;var u={start:"start",update:"update",end:"end"},c=function(){return Date.now}();s.prototype.sleep=function(){this._isSleeping||(this.emit(u.end,this),this._isSleeping=!0)},s.prototype.wake=function(){this._isSleeping&&(this.emit(u.start,this),this._isSleeping=!1,this._prevTime=c())},s.prototype.isBody=!1,s.prototype.setPosition=function(t){this.position.set(t)},s.prototype.setPosition1D=function(t){this.position.x=t},s.prototype.getPosition=function(){return this._positionGetter instanceof Function&&this.setPosition(this._positionGetter()),this._engine.step(),this.position.get()},s.prototype.getPosition1D=function(){return this._engine.step(),this.position.x},s.prototype.positionFrom=function(t){this._positionGetter=t},s.prototype.setVelocity=function(t){this.velocity.set(t),this.wake()},s.prototype.setVelocity1D=function(t){this.velocity.x=t,this.wake()},s.prototype.getVelocity=function(){return this.velocity.get()},s.prototype.getVelocity1D=function(){return this.velocity.x},s.prototype.setMass=function(t){this.mass=t,this.inverseMass=1/t},s.prototype.getMass=function(){return this.mass},s.prototype.reset=function(t,i){this.setPosition(t||[0,0,0]),this.setVelocity(i||[0,0,0])},s.prototype.applyForce=function(t){t.isZero()||(this.force.add(t).put(this.force),this.wake())},s.prototype.applyImpulse=function(t){if(!t.isZero()){var i=this.velocity;i.add(t.mult(this.inverseMass)).put(i)}},s.prototype.integrateVelocity=function(t){s.INTEGRATOR.integrateVelocity(this,t)},s.prototype.integratePosition=function(t){s.INTEGRATOR.integratePosition(this,t)},s.prototype._integrate=function(t){this.integrateVelocity(t),this.integratePosition(t)},s.prototype.getEnergy=function(){return.5*this.mass*this.velocity.normSquared()},s.prototype.getTransform=function(){this._engine.step();var t=this.position,i=this.axis,e=this.transform;return void 0!==i&&(i&~s.AXES.X&&(t.x=0),i&~s.AXES.Y&&(t.y=0),i&~s.AXES.Z&&(t.z=0)),e[12]=t.x,e[13]=t.y,e[14]=t.z,e},s.prototype.modify=function(t){var i=this._spec;return i.transform=this.getTransform(),i.target=t,i},s.prototype.emit=function(t,i){this._eventOutput&&this._eventOutput.emit(t,i)},s.prototype.on=function(){return o.call(this),this.on.apply(this,arguments)},s.prototype.removeListener=function(){return o.call(this),this.removeListener.apply(this,arguments)},s.prototype.pipe=function(){return o.call(this),this.pipe.apply(this,arguments)},s.prototype.unpipe=function(){return o.call(this),this.unpipe.apply(this,arguments)},e.exports=s}),define("famous/physics/constraints/Constraint",["require","exports","module","famous/core/EventHandler"],function(t,i,e){function s(){this.options=this.options||{},this._energy=0,this._eventOutput=null}function o(){this._eventOutput=new n,this._eventOutput.bindThis(this),n.setOutputHandler(this,this._eventOutput)}var n=t("famous/core/EventHandler");s.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},s.prototype.applyConstraint=function(){},s.prototype.getEnergy=function(){return this._energy},s.prototype.setEnergy=function(t){this._energy=t},s.prototype.on=function(){return o.call(this),this.on.apply(this,arguments)},s.prototype.addListener=function(){return o.call(this),this.addListener.apply(this,arguments)},s.prototype.pipe=function(){return o.call(this),this.pipe.apply(this,arguments)},s.prototype.removeListener=function(){return this.removeListener.apply(this,arguments)},s.prototype.unpipe=function(){return this.unpipe.apply(this,arguments)},e.exports=s}),define("famous/physics/constraints/Snap",["require","exports","module","./Constraint","famous/math/Vector"],function(t,i,e){function s(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS),t&&this.setOptions(t),this.pDiff=new r,this.vDiff=new r,this.impulse1=new r,this.impulse2=new r,n.call(this)}function o(t,i,e){return Math.abs(t.dot(i)/e)}var n=t("./Constraint"),r=t("famous/math/Vector");s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS={period:300,dampingRatio:.1,length:0,anchor:void 0};var a=Math.PI;s.prototype.setOptions=function(t){void 0!==t.anchor&&(t.anchor instanceof r&&(this.options.anchor=t.anchor),t.anchor.position instanceof r&&(this.options.anchor=t.anchor.position),t.anchor instanceof Array&&(this.options.anchor=new r(t.anchor))),void 0!==t.length&&(this.options.length=t.length),void 0!==t.dampingRatio&&(this.options.dampingRatio=t.dampingRatio),void 0!==t.period&&(this.options.period=t.period)},s.prototype.setAnchor=function(t){void 0!==this.options.anchor&&(this.options.anchor=new r),this.options.anchor.set(t)},s.prototype.getEnergy=function(t,i){var e=this.options,s=e.length,o=e.anchor||i.position,n=Math.pow(2*a/e.period,2),r=o.sub(t.position).norm()-s;return.5*n*r*r},s.prototype.applyConstraint=function(t,i,e){for(var s=this.options,n=this.pDiff,r=this.vDiff,h=this.impulse1,u=this.impulse2,c=s.length,p=s.anchor||i.position,l=s.period,f=s.dampingRatio,d=0;di?-((1+u)*a.dot(n)+p/e*(i-l))/(r*e+f):-((1+u)*a.dot(n))/(r*e+f);c.set(a.mult(e*m)),t.applyImpulse(c),t.setPosition(o.add(a.mult(-i)))}this._eventOutput&&this._eventOutput.emit("postCollision",d)}function a(t,i){var e=this.options.onContact,o=t.position,n=this.options.normal;e===s.ON_CONTACT.REFLECT&&t.setPosition(o.add(n.mult(-i)))}var h=t("./Constraint"),u=t("famous/math/Vector");s.prototype=Object.create(h.prototype),s.prototype.constructor=s,s.ON_CONTACT={REFLECT:0,SILENT:1},s.DEFAULT_OPTIONS={restitution:.5,drift:.5,slop:0,normal:[1,0,0],distance:0,onContact:s.ON_CONTACT.REFLECT},s.prototype.setOptions=function(t){void 0!==t.normal&&(t.normal instanceof u&&(this.options.normal=t.normal.clone()),t.normal instanceof Array&&(this.options.normal=new u(t.normal))),void 0!==t.restitution&&(this.options.restitution=t.restitution),void 0!==t.drift&&(this.options.drift=t.drift),void 0!==t.slop&&(this.options.slop=t.slop),void 0!==t.distance&&(this.options.distance=t.distance),void 0!==t.onContact&&(this.options.onContact=t.onContact)},s.prototype.applyConstraint=function(t,i,e){for(var s=this.options.normal,h=0;h=f&&(0>d?r.call(this,u,f,e):a.call(this,u,f,e))}},e.exports=s}),define("famous/transitions/WallTransition",["require","exports","module","famous/physics/PhysicsEngine","famous/physics/bodies/Particle","famous/physics/forces/Spring","famous/physics/constraints/Wall","famous/math/Vector"],function(t,i,e){function s(t){t=t||0,this.endState=new O(t),this.initState=new O,this.spring=new g({anchor:this.endState}),this.wall=new v,this._restTolerance=1e-10,this._dimensions=1,this._absRestTolerance=this._restTolerance,this._callback=void 0,this.PE=new y,this.particle=new _,this.PE.addBody(this.particle),this.PE.attach([this.wall,this.spring],this.particle)}function o(){return this.particle.getEnergy()+this.spring.getEnergy(this.particle)}function n(){var t=this.endState.sub(this.initState).normSquared();this._absRestTolerance=0===t?this._restTolerance:this._restTolerance*t}function r(){this.PE.wake()}function a(){this.PE.sleep()}function h(t){this.endState.set(t);var i=this.endState.sub(this.initState).norm();this.wall.setOptions({distance:this.endState.norm(),normal:0===i?this.particle.velocity.normalize(-1):this.endState.sub(this.initState).normalize(-1)}),n.call(this)}function u(t){this.particle.position.set(t)}function c(t){this.particle.velocity.set(t)}function p(){return 0===this._dimensions?this.particle.getPosition1D():this.particle.getPosition()}function l(){return 0===this._dimensions?this.particle.getVelocity1D():this.particle.getVelocity()}function f(t){this._callback=t}function d(){if(this.PE.isSleeping()){if(this._callback){var t=this._callback;this._callback=void 0,t()}}else{var i=o.call(this);i=i&&(t.apply(this,arguments),c.removeListener(p,o))};return s(o)}function n(t,i){var e=l(),o=function(){var s=l();s-e>=i&&(t.apply(this,arguments),e=l())};return s(o)}function r(t,i){if(void 0===i)return void 0;var e=function(){i--,0>=i&&(t.apply(this,arguments),h(e))};return s(e)}function a(t,i){i=i||1;var e=i,o=function(){i--,0>=i&&(t.apply(this,arguments),i=e)};return s(o)}function h(t){c.removeListener(p,t)}function u(t,i){var e,s,n,r,a;return function(){s=this,a=arguments,n=l();var u=function(){var h=l-n;i>h?e=o(u,i-h):(e=null,r=t.apply(s,a))};return h(e),e=o(u,i),r}}var c=t("famous/core/Engine"),p="prerender",l=window.performance?function(){return window.performance.now()}:function(){return Date.now()};e.exports={setTimeout:o,setInterval:n,debounce:u,after:r,every:a,clear:h}}),define("famous/views/ContextualView",["require","exports","module","famous/core/Entity","famous/core/Transform","famous/core/EventHandler","famous/core/OptionsManager"],function(t,i,e){function s(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS||s.DEFAULT_OPTIONS),this._optionsManager=new r(this.options),t&&this.setOptions(t),this._eventInput=new n,this._eventOutput=new n,n.setInputHandler(this,this._eventInput),n.setOutputHandler(this,this._eventOutput),this._id=o.register(this)}var o=t("famous/core/Entity"),n=(t("famous/core/Transform"),t("famous/core/EventHandler")),r=t("famous/core/OptionsManager");s.DEFAULT_OPTIONS={},s.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},s.prototype.getOptions=function(){return this._optionsManager.getOptions()},s.prototype.render=function(){return this._id},s.prototype.commit=function(){},e.exports=s}),define("famous/views/SequentialLayout",["require","exports","module","famous/core/OptionsManager","famous/core/Transform","famous/core/ViewSequence","famous/utilities/Utility"],function(t,i,e){function s(t){this._items=null,this._size=null,this._outputFunction=s.DEFAULT_OUTPUT_FUNCTION,this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this.optionsManager=new o(this.options),this._itemsCache=[],this._outputCache={size:null,target:this._itemsCache},t&&this.setOptions(t)}var o=t("famous/core/OptionsManager"),n=t("famous/core/Transform"),r=t("famous/core/ViewSequence"),a=t("famous/utilities/Utility");s.DEFAULT_OPTIONS={direction:a.Direction.Y,itemSpacing:0,defaultItemSize:[50,50]},s.DEFAULT_OUTPUT_FUNCTION=function(t,i){var e=this.options.direction===a.Direction.X?n.translate(i,0):n.translate(0,i);return{transform:e,target:t.render()}},s.prototype.getSize=function(){return this._size||this.render(),this._size},s.prototype.sequenceFrom=function(t){return t instanceof Array&&(t=new r(t)),this._items=t,this},s.prototype.setOptions=function(){return this.optionsManager.setOptions.apply(this.optionsManager,arguments),this},s.prototype.setOutputFunction=function(t){return this._outputFunction=t,this},s.prototype.render=function(){for(var t=0,i=0,e=this.options.direction===a.Direction.X?0:1,s=this.options.direction===a.Direction.X?1:0,o=this._items,n=this._itemsCache,r=0;o;){var h=o.get();if(!h)break;var u;h&&h.getSize&&(u=h.getSize()),u||(u=this.options.defaultItemSize),u[s]!==!0&&(i=Math.max(i,u[s]));var c=this._outputFunction.call(this,h,t,r);n[r]=c,u[e]&&u[e]!==!0&&(t+=u[e]+this.options.itemSpacing),o=o.getNext(),r++}return this._itemsCache.splice(r),i||(i=void 0),this._size||(this._size=[0,0]),this._size[e]=t-this.options.itemSpacing,this._size[s]=i,this._outputCache.size=this.getSize(),this._outputCache},e.exports=s}),define("famous/views/Deck",["require","exports","module","famous/core/Transform","famous/core/OptionsManager","famous/transitions/Transitionable","famous/utilities/Utility","./SequentialLayout"],function(t,i,e){function s(){c.apply(this,arguments),this.state=new h(0),this._isOpen=!1,this.setOutputFunction(function(t,i,e){var s=o.call(this),n=this.options.direction===u.Direction.X?r.translate(s*i,0,.001*(s-1)*i):r.translate(0,s*i,.001*(s-1)*i),a=t.render();if(this.options.stackRotation){var h=this.options.stackRotation*e*(1-s);a={transform:r.rotateZ(h),origin:[.5,.5],target:a}}return{transform:n,size:t.getSize(),target:a}})}function o(t){return t?this._isOpen?1:0:this.state.get()}function n(t,i,e){this.state.halt(),this.state.set(t,i,e)}var r=t("famous/core/Transform"),a=t("famous/core/OptionsManager"),h=t("famous/transitions/Transitionable"),u=t("famous/utilities/Utility"),c=t("./SequentialLayout");s.prototype=Object.create(c.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS=a.patch(c.DEFAULT_OPTIONS,{transition:{curve:"easeOutBounce",duration:500},stackRotation:0}),s.prototype.getSize=function(){var t=c.prototype.getSize.apply(this,arguments),i=this._items?this._items.get().getSize():[0,0];i||(i=[0,0]);var e=o.call(this),s=1-e;return[i[0]*s+t[0]*e,i[1]*s+t[1]*e]},s.prototype.isOpen=function(){return this._isOpen},s.prototype.open=function(t){this._isOpen=!0,n.call(this,1,this.options.transition,t)},s.prototype.close=function(t){this._isOpen=!1,n.call(this,0,this.options.transition,t)},s.prototype.toggle=function(t){this._isOpen?this.close(t):this.open(t)},e.exports=s}),define("famous/views/RenderController",["require","exports","module","famous/core/Modifier","famous/core/RenderNode","famous/core/Transform","famous/transitions/Transitionable","famous/core/View"],function(t,i,e){function s(){u.apply(this,arguments),this._showing=-1,this._outgoingRenderables=[],this._nextRenderable=null,this._renderables=[],this._nodes=[],this._modifiers=[],this._states=[],this.inTransformMap=s.DefaultMap.transform,this.inOpacityMap=s.DefaultMap.opacity,this.inOriginMap=s.DefaultMap.origin,this.outTransformMap=s.DefaultMap.transform,this.outOpacityMap=s.DefaultMap.opacity,this.outOriginMap=s.DefaultMap.origin,this._output=[]}function o(t,i){return t(i.get())}var n=t("famous/core/Modifier"),r=t("famous/core/RenderNode"),a=t("famous/core/Transform"),h=t("famous/transitions/Transitionable"),u=t("famous/core/View");s.prototype=Object.create(u.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS={inTransition:!0,outTransition:!0,overlap:!0},s.DefaultMap={transform:function(){return a.identity},opacity:function(t){return t},origin:null},s.prototype.inTransformFrom=function(t){if(t instanceof Function)this.inTransformMap=t;else{if(!t||!t.get)throw Error("inTransformFrom takes only function or getter object");this.inTransformMap=t.get.bind(t)}return this},s.prototype.inOpacityFrom=function(t){if(t instanceof Function)this.inOpacityMap=t;else{if(!t||!t.get)throw Error("inOpacityFrom takes only function or getter object");this.inOpacityMap=t.get.bind(t)}return this},s.prototype.inOriginFrom=function(t){if(t instanceof Function)this.inOriginMap=t;else{if(!t||!t.get)throw Error("inOriginFrom takes only function or getter object");this.inOriginMap=t.get.bind(t)}return this},s.prototype.outTransformFrom=function(t){if(t instanceof Function)this.outTransformMap=t;else{if(!t||!t.get)throw Error("inTransformFrom takes only function or getter object");this.outTransformMap=t.get.bind(t)}return this},s.prototype.outOpacityFrom=function(t){if(t instanceof Function)this.outOpacityMap=t;else{if(!t||!t.get)throw Error("inOpacityFrom takes only function or getter object");this.outOpacityMap=t.get.bind(t)}return this},s.prototype.outOriginFrom=function(t){if(t instanceof Function)this.outOriginMap=t;else{if(!t||!t.get)throw Error("inOriginFrom takes only function or getter object");this.outOriginMap=t.get.bind(t)}return this},s.prototype.show=function(t,i,e){if(!t)return this.hide(e);if(i instanceof Function&&(e=i,i=null),this._showing>=0){if(!this.options.overlap)return void(this._nextRenderable?this._nextRenderable=t:(this._nextRenderable=t,this.hide(function(){this._nextRenderable===t&&this.show(this._nextRenderable,e),this._nextRenderable=null})));this.hide()}var s=null,a=this._renderables.indexOf(t);if(a>=0){this._showing=a,s=this._states[a],s.halt();var u=this._outgoingRenderables.indexOf(t);u>=0&&this._outgoingRenderables.splice(u,1)}else{s=new h(0);var c=new n({transform:this.inTransformMap?o.bind(this,this.inTransformMap,s):null,opacity:this.inOpacityMap?o.bind(this,this.inOpacityMap,s):null,origin:this.inOriginMap?o.bind(this,this.inOriginMap,s):null}),p=new r;p.add(c).add(t),this._showing=this._nodes.length,this._nodes.push(p),this._modifiers.push(c),this._states.push(s),this._renderables.push(t)}i||(i=this.options.inTransition),s.set(1,i,e)},s.prototype.hide=function(t,i){if(!(this._showing<0)){var e=this._showing;this._showing=-1,t instanceof Function&&(i=t,t=void 0);var s=this._nodes[e],n=this._modifiers[e],r=this._states[e],a=this._renderables[e];n.transformFrom(this.outTransformMap?o.bind(this,this.outTransformMap,r):null),n.opacityFrom(this.outOpacityMap?o.bind(this,this.outOpacityMap,r):null),n.originFrom(this.outOriginMap?o.bind(this,this.outOriginMap,r):null),this._outgoingRenderables.indexOf(a)<0&&this._outgoingRenderables.push(a),t||(t=this.options.outTransition),r.halt(),r.set(0,t,function(t,e,s,o){if(this._outgoingRenderables.indexOf(o)>=0){var n=this._nodes.indexOf(t);this._nodes.splice(n,1),this._modifiers.splice(n,1),this._states.splice(n,1),this._renderables.splice(n,1),this._outgoingRenderables.splice(this._outgoingRenderables.indexOf(o),1),this._showing>=n&&this._showing--}i&&i.call(this)}.bind(this,s,n,r,a))}},s.prototype.render=function(){var t=this._output;t.length>this._nodes.length&&t.splice(this._nodes.length);for(var i=0;ip;p++){o=0;for(var l=0;i>l;l++)void 0===this._modifiers[c]?n.call(this,c,[h,a],[o,u,0],1):r.call(this,c,[h,a],[o,u,0],1),c++,o+=h+this.options.gutterSize[0];u+=a+this.options.gutterSize[1]}for(this._dimensionsCache=[this.options.dimensions[0],this.options.dimensions[1]],this._contextSizeCache=[t[0],t[1]],this._activeCount=e*i,p=this._activeCount;p=this._activeCount&&this._states[p].opacity.isActive()&&(this._modifiers.splice(p,1),this._states.splice(p,1)),l&&c.push(f.modify({origin:s,target:l.render()})),u=u.getNext(),p++}return n&&(i=h.moveThen([-n[0]*s[0],-n[1]*s[1],0],i)),{transform:i,opacity:e,size:n,target:c}},e.exports=s}),define("famous/views/HeaderFooterLayout",["require","exports","module","famous/core/Entity","famous/core/RenderNode","famous/core/Transform","famous/core/OptionsManager"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new c(this.options),t&&this.setOptions(t),this._entityId=a.register(this),this.header=new h,this.footer=new h,this.content=new h}function o(t,i){var e=t.getSize();return e?e[this.options.direction]:i}function n(t){return this.options.direction===s.DIRECTION_X?u.translate(t,0,0):u.translate(0,t,0)}function r(t,i){return this.options.direction===s.DIRECTION_X?[t,i[1]]:[i[0],t]}var a=t("famous/core/Entity"),h=t("famous/core/RenderNode"),u=t("famous/core/Transform"),c=t("famous/core/OptionsManager");s.DIRECTION_X=0,s.DIRECTION_Y=1,s.DEFAULT_OPTIONS={direction:s.DIRECTION_Y,headerSize:void 0,footerSize:void 0,defaultHeaderSize:0,defaultFooterSize:0},s.prototype.render=function(){return this._entityId},s.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},s.prototype.commit=function(t){var i=t.transform,e=t.origin,s=t.size,a=t.opacity,h=void 0!==this.options.headerSize?this.options.headerSize:o.call(this,this.header,this.options.defaultHeaderSize),c=void 0!==this.options.footerSize?this.options.footerSize:o.call(this,this.footer,this.options.defaultFooterSize),p=s[this.options.direction]-h-c;s&&(i=u.moveThen([-s[0]*e[0],-s[1]*e[1],0],i));var l=[{size:r.call(this,h,s),target:this.header.render()},{transform:n.call(this,h),size:r.call(this,p,s),target:this.content.render()},{transform:n.call(this,h+p),size:r.call(this,c,s),target:this.footer.render()}];return{transform:i,opacity:a,size:s,target:l}},e.exports=s}),define("famous/views/Lightbox",["require","exports","module","famous/core/Transform","famous/core/Modifier","famous/core/RenderNode","famous/utilities/Utility","famous/core/OptionsManager","famous/transitions/Transitionable","famous/transitions/TransitionableTransform"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new h(this.options),t&&this.setOptions(t),this._showing=!1,this.nodes=[],this.transforms=[],this.states=[]}var o=t("famous/core/Transform"),n=t("famous/core/Modifier"),r=t("famous/core/RenderNode"),a=t("famous/utilities/Utility"),h=t("famous/core/OptionsManager"),u=t("famous/transitions/Transitionable"),c=t("famous/transitions/TransitionableTransform");s.DEFAULT_OPTIONS={inTransform:o.scale(.001,.001,.001),inOpacity:0,inOrigin:[.5,.5],outTransform:o.scale(.001,.001,.001),outOpacity:0,outOrigin:[.5,.5],showTransform:o.identity,showOpacity:1,showOrigin:[.5,.5],inTransition:!0,outTransition:!0,overlap:!1},s.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},s.prototype.show=function(t,i,e){if(!t)return this.hide(e);if(i instanceof Function&&(e=i,i=void 0),this._showing){if(!this.options.overlap)return this.hide(this.show.bind(this,t,i,e));this.hide()}this._showing=!0;var s={transform:new c(this.options.inTransform),origin:new u(this.options.inOrigin),opacity:new u(this.options.inOpacity)},o=new n({transform:s.transform,opacity:s.opacity,origin:s.origin}),h=new r;h.add(o).add(t),this.nodes.push(h),this.states.push(s),this.transforms.push(o);var p=e?a.after(3,e):void 0;i||(i=this.options.inTransition),s.transform.set(this.options.showTransform,i,p),s.opacity.set(this.options.showOpacity,i,p),s.origin.set(this.options.showOrigin,i,p)},s.prototype.hide=function(t,i){if(this._showing){this._showing=!1,t instanceof Function&&(i=t,t=void 0);var e=this.nodes[this.nodes.length-1],s=this.transforms[this.transforms.length-1],o=this.states[this.states.length-1],n=a.after(3,function(){this.nodes.splice(this.nodes.indexOf(e),1),this.states.splice(this.states.indexOf(o),1),this.transforms.splice(this.transforms.indexOf(s),1),i&&i.call(this)}.bind(this));t||(t=this.options.outTransition),o.transform.set(this.options.outTransform,t,n),o.opacity.set(this.options.outOpacity,t,n),o.origin.set(this.options.outOrigin,t,n)}},s.prototype.render=function(){for(var t=[],i=0;i=t;)this._positionOffset-=t,this._node=i,t=o.call(this,this._node.getSize()),i=this._node&&this._node.getNext?this._node.getNext():null;for(var e=this._node&&this._node.getPrevious?this._node.getPrevious():null;e&&this._position+this._positionOffset<0;){var s=o.call(this,e.getSize());this._positionOffset+=s,this._node=e,e=this._node&&this._node.getPrevious?this._node.getPrevious():null}}function h(){var t=null,i=this._position,e=[];this._onEdge=0;for(var s=-this._positionOffset,h=r.call(this),u=this._node;u&&s-is){for(;c&&h>p;)c=c.getPrevious(),c&&(p+=o.call(this,c.getSize()));for(c=this._node;c&&h>p;)c=c.getNext(),c&&(p+=o.call(this,c.getSize()))}var l=void 0!==p&&h>p?p:h;for(!u&&l>=s-i?(this._onEdge=1,this._eventOutput.emit("edgeHit",{position:s-l})):!this._node.getPrevious()&&0>=i&&(this._onEdge=-1,this._eventOutput.emit("edgeHit",{position:0})),u=this._node&&this._node.getPrevious?this._node.getPrevious():null,s=-this._positionOffset,u&&(t=u.getSize?u.getSize():this._contextSize,s-=o.call(this,t));u&&s-i>-(r.call(this)+this.options.margin);)n.call(this,u,s,e),u=u.getPrevious?u.getPrevious():null,u&&(t=u.getSize?u.getSize():this._contextSize,s-=o.call(this,t));return a.call(this),e}var u=t("famous/core/Entity"),c=t("famous/core/Group"),p=t("famous/core/OptionsManager"),l=t("famous/core/Transform"),f=t("famous/utilities/Utility"),d=t("famous/core/ViewSequence"),m=t("famous/core/EventHandler");s.DEFAULT_OPTIONS={direction:f.Direction.Y,margin:0,clipSize:void 0,groupScroll:!1},s.prototype.setOptions=function(t){this._optionsManager.setOptions(t),this.options.groupScroll?this.group.pipe(this._eventOutput):this.group.unpipe(this._eventOutput)},s.prototype.onEdge=function(){return this._onEdge},s.prototype.outputFrom=function(t,i){t||(t=function(t){return this.options.direction===f.Direction.X?l.translate(t,0):l.translate(0,t)}.bind(this),i||(i=t)),this._outputFunction=t,this._masterOutputFunction=i?i:function(i){return l.inverse(t(-i))}},s.prototype.positionFrom=function(t){t instanceof Function?this._positionGetter=t:t&&t.get?this._positionGetter=t.get.bind(t):(this._positionGetter=null,this._position=t),this._positionGetter&&(this._position=this._positionGetter.call(this))},s.prototype.sequenceFrom=function(t){t instanceof Array&&(t=new d({array:t})),this._node=t,this._positionOffset=0},s.prototype.getSize=function(t){return t?this._contextSize:this._size},s.prototype.render=function(){return this._node?(this._positionGetter&&(this._position=this._positionGetter.call(this)),this._entityId):null},s.prototype.commit=function(t){var i=t.transform,e=t.opacity,s=t.origin,o=t.size;this.options.clipSize||o[0]===this._contextSize[0]&&o[1]===this._contextSize[1]||(this._onEdge=0,this._contextSize[0]=o[0],this._contextSize[1]=o[1],this.options.direction===f.Direction.X?(this._size[0]=r.call(this),this._size[1]=void 0):(this._size[0]=void 0,this._size[1]=r.call(this)));var n=this._masterOutputFunction(-this._position);return{transform:l.multiply(i,n),size:o,opacity:e,origin:s,target:this.group.render()}},e.exports=s}),define("famous/views/Scrollview",["require","exports","module","famous/physics/PhysicsEngine","famous/physics/bodies/Particle","famous/physics/forces/Drag","famous/physics/forces/Spring","famous/core/EventHandler","famous/core/OptionsManager","famous/core/ViewSequence","famous/views/Scroller","famous/utilities/Utility","famous/inputs/GenericSync","famous/inputs/ScrollSync","famous/inputs/TouchSync"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new T(this.options),this._node=null,this._physicsEngine=new y,this._particle=new _,this._physicsEngine.addBody(this._particle),this.spring=new v({anchor:[0,0,0]}),this.drag=new g({forceFunction:g.FORCE_FUNCTIONS.QUADRATIC}),this.friction=new g({forceFunction:g.FORCE_FUNCTIONS.LINEAR}),this.sync=new x(["scroll","touch"],{direction:this.options.direction}),this._eventInput=new O,this._eventOutput=new O,this._eventInput.pipe(this.sync),this.sync.pipe(this._eventInput),O.setInputHandler(this,this._eventInput),O.setOutputHandler(this,this._eventOutput),this._touchCount=0,this._springState=0,this._onEdge=0,this._pageSpringPosition=0,this._edgeSpringPosition=0,this._touchVelocity=void 0,this._earlyEnd=!1,this._needsPaginationCheck=!1,this._scroller=new w,this._scroller.positionFrom(this.getPosition.bind(this)),this.setOptions(t),a.call(this)}function o(t){this._touchCount=t.count,void 0===t.count&&(this._touchCount=1),u.call(this),this.setVelocity(0),this._touchVelocity=0,this._earlyEnd=!1}function n(t){var i=-t.velocity,e=-t.delta;this._onEdge&&t.slip&&(0>i&&this._onEdge<0||i>0&&this._onEdge>0?this._earlyEnd||(r.call(this,t),this._earlyEnd=!0):this._earlyEnd&&Math.abs(i)>Math.abs(this.getVelocity())&&o.call(this,t)),this._earlyEnd||(this._touchVelocity=i,t.slip?this.setVelocity(i):this.setPosition(this.getPosition()+e))}function r(t){if(this._touchCount=t.count||0,!this._touchCount){u.call(this),this._onEdge&&f.call(this,this._edgeSpringPosition,C.EDGE),h.call(this);var i=-t.velocity,e=this.options.speedLimit;t.slip&&(e*=this.options.edgeGrip),-e>i?i=-e:i>e&&(i=e),this.setVelocity(i),this._touchVelocity=void 0,this._needsPaginationCheck=!0}}function a(){this._eventInput.bindThis(this),this._eventInput.on("start",o),this._eventInput.on("update",n),this._eventInput.on("end",r),this._scroller.on("edgeHit",function(t){this._edgeSpringPosition=t.position}.bind(this))}function h(){this._springState?this._physicsEngine.attach([this.spring],this._particle):this._physicsEngine.attach([this.drag,this.friction],this._particle)}function u(){this._springState=C.NONE,this._physicsEngine.detachAll()}function c(t){var i=this.options.direction,e=(t.getSize()||this._scroller.getSize())[i];return e||(e=this._scroller.getSize()[i]),e}function p(t){!this._onEdge&&t?(this.sync.setOptions({scale:this.options.edgeGrip}),this._touchCount||this._springState===C.EDGE||f.call(this,this._edgeSpringPosition,C.EDGE)):this._onEdge&&!t&&(this.sync.setOptions({scale:1}),this._springState&&Math.abs(this.getVelocity())<.001&&(u.call(this),h.call(this))),this._onEdge=t}function l(){if(this._needsPaginationCheck&&!this._touchCount&&this._springState!==C.EDGE){var t=this.getVelocity();if(!(Math.abs(t)>=this.options.pageStopSpeed)){var i=this.getPosition(),e=Math.abs(t)>this.options.pageSwitchSpeed,s=c.call(this,this._node),o=i>.5*s,n=t>0;o&&!e||e&&n?this.goToNextPage():f.call(this,0,C.PAGE),this._needsPaginationCheck=!1}}}function f(t,i){var e;i===C.EDGE?(this._edgeSpringPosition=t,e={anchor:[this._edgeSpringPosition,0,0],period:this.options.edgePeriod,dampingRatio:this.options.edgeDamp}):i===C.PAGE&&(this._pageSpringPosition=t,e={anchor:[this._pageSpringPosition,0,0],period:this.options.pagePeriod,dampingRatio:this.options.pageDamp}),this.spring.setOptions(e),i&&!this._springState&&(u.call(this),this._springState=i,h.call(this)),this._springState=i}function d(){for(var t=this.getPosition(),i=c.call(this,this._node),e=this._node.getNext();t>i+M&&e;)m.call(this,-i),t-=i,this._scroller.sequenceFrom(e),this._node=e,e=this._node.getNext(),i=c.call(this,this._node);for(var s,o=this._node.getPrevious();-M>t&&o;)s=c.call(this,o),this._scroller.sequenceFrom(o),this._node=o,m.call(this,s),t+=s,o=this._node.getPrevious()}function m(t){this._edgeSpringPosition+=t,this._pageSpringPosition+=t,this.setPosition(this.getPosition()+t),this._springState===C.EDGE?this.spring.setOptions({anchor:[this._edgeSpringPosition,0,0]}):this._springState===C.PAGE&&this.spring.setOptions({anchor:[this._pageSpringPosition,0,0]})}var y=t("famous/physics/PhysicsEngine"),_=t("famous/physics/bodies/Particle"),g=t("famous/physics/forces/Drag"),v=t("famous/physics/forces/Spring"),O=t("famous/core/EventHandler"),T=t("famous/core/OptionsManager"),S=t("famous/core/ViewSequence"),w=t("famous/views/Scroller"),b=t("famous/utilities/Utility"),x=t("famous/inputs/GenericSync"),E=t("famous/inputs/ScrollSync"),I=t("famous/inputs/TouchSync");x.register({scroll:E,touch:I});var M=.5;s.DEFAULT_OPTIONS={direction:b.Direction.Y,rails:!0,friction:.001,drag:1e-4,edgeGrip:.5,edgePeriod:300,edgeDamp:1,margin:1e3,paginated:!1,pagePeriod:500,pageDamp:.8,pageStopSpeed:10,pageSwitchSpeed:.5,speedLimit:10,groupScroll:!1};var C={NONE:0,EDGE:1,PAGE:2};s.prototype.outputFrom=function(){return this._scroller.outputFrom.apply(this._scroller,arguments)},s.prototype.getPosition=function(){return this._particle.getPosition1D()},s.prototype.setPosition=function(t){this._particle.setPosition1D(t)},s.prototype.getVelocity=function(){return this._touchCount?this._touchVelocity:this._particle.getVelocity1D()},s.prototype.setVelocity=function(t){this._particle.setVelocity1D(t)},s.prototype.setOptions=function(t){t&&(void 0!==t.direction&&("x"===t.direction?t.direction=b.Direction.X:"y"===t.direction&&(t.direction=b.Direction.Y)),this._scroller.setOptions(t),this._optionsManager.setOptions(t)),this._scroller.setOptions(this.options),this.options.groupScroll?this._scroller.pipe(this._eventInput):this._scroller.unpipe(this._eventInput),this.drag.setOptions({strength:this.options.drag}),this.friction.setOptions({strength:this.options.friction}),this.spring.setOptions({period:this.options.edgePeriod,dampingRatio:this.options.edgeDamp}),this.sync.setOptions({rails:this.options.rails,direction:this.options.direction===b.Direction.X?x.DIRECTION_X:x.DIRECTION_Y})},s.prototype.goToPreviousPage=function(){if(!this._node)return null;var t=this._node.getPrevious();if(t){var i=this.getPosition(),e=c.call(this,t);this._scroller.sequenceFrom(t),this._node=t;var s=M>i?-e:0;f.call(this,s,C.PAGE),m.call(this,e)}return this._eventOutput.emit("pageChange",{direction:-1}),t},s.prototype.goToNextPage=function(){if(!this._node)return null;var t=this._node.getNext();if(t){var i=this.getPosition(),e=c.call(this,this._node),s=c.call(this,t);this._scroller.sequenceFrom(t),this._node=t;var o=i>e-M?e+s:e;f.call(this,o,C.PAGE),m.call(this,-e)}return this._eventOutput.emit("pageChange",{direction:1}),t},s.prototype.sequenceFrom=function(t){return t instanceof Array&&(t=new S({array:t})),this._node=t,this._scroller.sequenceFrom(t)},s.prototype.getSize=function(){return this._scroller.getSize.apply(this._scroller,arguments)},s.prototype.render=function(){return this._node?(d.call(this),p.call(this,this._scroller.onEdge()),this.options.paginated&&l.call(this),this._scroller.render()):null},e.exports=s}),define("famous/views/ScrollContainer",["require","exports","module","famous/surfaces/ContainerSurface","famous/core/EventHandler","./Scrollview","famous/utilities/Utility","famous/core/OptionsManager"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this._optionsManager=new h(this.options),t&&this.setOptions(t),this.container=new o(this.options.container),this.scrollview=new r(this.options.scrollview),this.container.add(this.scrollview),n.setInputHandler(this,this.scrollview),n.setOutputHandler(this,this.scrollview),this.scrollview.subscribe(this.container)}var o=t("famous/surfaces/ContainerSurface"),n=t("famous/core/EventHandler"),r=t("./Scrollview"),a=t("famous/utilities/Utility"),h=t("famous/core/OptionsManager");s.DEFAULT_OPTIONS={container:{properties:{overflow:"hidden"}},scrollview:{direction:a.Direction.X}},s.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},s.prototype.sequenceFrom=function(){return this.scrollview.sequenceFrom.apply(this.scrollview,arguments)},s.prototype.render=function(){return this.container.render.apply(this.container,arguments)},e.exports=s}),define("famous/widgets/NavigationBar",["require","exports","module","famous/core/Scene","famous/core/Surface","famous/core/Transform","famous/core/View"],function(t,i,e){function s(){a.apply(this,arguments),this.title=new n({classes:this.options.classes,content:this.options.content}),this.back=new n({size:[this.options.size[1],this.options.size[1]],classes:this.options.classes,content:this.options.backContent}),this.back.on("click",function(){this._eventOutput.emit("back",{})}.bind(this)),this.more=new n({size:[this.options.size[1],this.options.size[1]],classes:this.options.classes,content:this.options.moreContent}),this.more.on("click",function(){this._eventOutput.emit("more",{})}.bind(this)),this.layout=new o({id:"master",size:this.options.size,target:[{transform:r.inFront,origin:[0,.5],target:this.back},{origin:[.5,.5],target:this.title},{transform:r.inFront,origin:[1,.5],target:this.more}]}),this._add(this.layout),this._optionsManager.on("change",function(t){var i=t.id,e=t.value;"size"===i?(this.layout.id.master.setSize(e),this.title.setSize(e),this.back.setSize([e[1],e[1]]),this.more.setSize([e[1],e[1]])):"backClasses"===i?this.back.setOptions({classes:this.options.classes.concat(this.options.backClasses)}):"backContent"===i?this.back.setContent(this.options.backContent):"classes"===i?(this.title.setOptions({classes:this.options.classes}),this.back.setOptions({classes:this.options.classes.concat(this.options.backClasses)}),this.more.setOptions({classes:this.options.classes.concat(this.options.moreClasses)})):"content"===i?this.setContent(this.options.content):"moreClasses"===i?this.more.setOptions({classes:this.options.classes.concat(this.options.moreClasses)}):"moreContent"===i&&this.more.setContent(this.options.content)}.bind(this))}var o=t("famous/core/Scene"),n=t("famous/core/Surface"),r=t("famous/core/Transform"),a=t("famous/core/View");s.prototype=Object.create(a.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS={size:[void 0,50],backClasses:["back"],backContent:"◀",classes:["navigation"],content:"",moreClasses:["more"],moreContent:"✚"},s.prototype.setContent=function(t){return this.title.setContent(t)},e.exports=s}),define("famous/widgets/Slider",["require","exports","module","famous/core/Surface","famous/surfaces/CanvasSurface","famous/core/Transform","famous/core/EventHandler","famous/math/Utilities","famous/core/OptionsManager","famous/inputs/MouseSync","famous/inputs/TouchSync","famous/inputs/GenericSync"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),this.optionsManager=new c(this.options),t&&this.setOptions(t),this.indicator=new r({size:this.options.indicatorSize,classes:["slider-back"]}),this.label=new n({size:this.options.labelSize,content:this.options.label,properties:{pointerEvents:"none"},classes:["slider-label"]}),this.eventOutput=new h,this.eventInput=new h,h.setInputHandler(this,this.eventInput),h.setOutputHandler(this,this.eventOutput);var i=(this.options.range[1]-this.options.range[0])/this.options.indicatorSize[0];this.sync=new f(["mouse","touch"],{scale:i,direction:f.DIRECTION_X}),this.indicator.pipe(this.sync),this.sync.pipe(this),this.eventInput.on("update",function(t){this.set(t.position)}.bind(this)),this._drawPos=0,o.call(this)}function o(){this.label.setContent(this.options.label+''+this.get().toFixed(this.options.precision)+"")}var n=t("famous/core/Surface"),r=t("famous/surfaces/CanvasSurface"),a=t("famous/core/Transform"),h=t("famous/core/EventHandler"),u=t("famous/math/Utilities"),c=t("famous/core/OptionsManager"),p=t("famous/inputs/MouseSync"),l=t("famous/inputs/TouchSync"),f=t("famous/inputs/GenericSync");f.register({mouse:p,touch:l}),s.DEFAULT_OPTIONS={size:[200,60],indicatorSize:[200,30],labelSize:[200,30],range:[0,1],precision:2,value:0,label:"",fillColor:"rgba(170, 170, 170, 1)"},s.prototype.setOptions=function(t){return this.optionsManager.setOptions(t)},s.prototype.get=function(){return this.options.value},s.prototype.set=function(t){t!==this.options.value&&(this.options.value=u.clamp(t,this.options.range),o.call(this),this.eventOutput.emit("change",{value:t}))},s.prototype.getSize=function(){return this.options.size},s.prototype.render=function(){var t=this.options.range,i=Math.floor((this.get()-t[0])/(t[1]-t[0])*this.options.indicatorSize[0]);if(ithis._drawPos){var e=this.indicator.getContext("2d");e.fillStyle=this.options.fillColor,e.fillRect(this._drawPos-1,0,i-this._drawPos+1,this.options.indicatorSize[1])}return this._drawPos=i,{size:this.options.size,target:[{origin:[0,0],target:this.indicator.render()},{transform:a.translate(0,0,1),origin:[0,0],target:this.label.render()}]}},e.exports=s}),define("famous/widgets/ToggleButton",["require","exports","module","famous/core/Surface","famous/core/EventHandler","famous/views/RenderController"],function(t,i,e){function s(t){this.options={content:"",offClasses:["off"],onClasses:["on"],size:void 0,outTransition:{curve:"easeInOut",duration:300},inTransition:{curve:"easeInOut",duration:300},toggleMode:s.TOGGLE,crossfade:!0},this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput),this.offSurface=new o,this.offSurface.on("click",function(){this.options.toggleMode!==s.OFF&&this.select()}.bind(this)),this.offSurface.pipe(this._eventOutput),this.onSurface=new o,this.onSurface.on("click",function(){this.options.toggleMode!==s.ON&&this.deselect()}.bind(this)),this.onSurface.pipe(this._eventOutput),this.arbiter=new r({overlap:this.options.crossfade}),this.deselect(),t&&this.setOptions(t)}var o=t("famous/core/Surface"),n=t("famous/core/EventHandler"),r=t("famous/views/RenderController");s.OFF=0,s.ON=1,s.TOGGLE=2,s.prototype.select=function(){this.selected=!0,this.arbiter.show(this.onSurface,this.options.inTransition),this._eventOutput.emit("select")},s.prototype.deselect=function(){this.selected=!1,this.arbiter.show(this.offSurface,this.options.outTransition),this._eventOutput.emit("deselect")},s.prototype.isSelected=function(){return this.selected},s.prototype.setOptions=function(t){void 0!==t.content&&(this.options.content=t.content,this.offSurface.setContent(this.options.content),this.onSurface.setContent(this.options.content)),t.offClasses&&(this.options.offClasses=t.offClasses,this.offSurface.setClasses(this.options.offClasses)),t.onClasses&&(this.options.onClasses=t.onClasses,this.onSurface.setClasses(this.options.onClasses)),void 0!==t.size&&(this.options.size=t.size,this.onSurface.setSize(this.options.size),this.offSurface.setSize(this.options.size)),void 0!==t.toggleMode&&(this.options.toggleMode=t.toggleMode),void 0!==t.outTransition&&(this.options.outTransition=t.outTransition),void 0!==t.inTransition&&(this.options.inTransition=t.inTransition),void 0!==t.crossfade&&(this.options.crossfade=t.crossfade,this.arbiter.setOptions({overlap:this.options.crossfade}))},s.prototype.getSize=function(){return this.options.size},s.prototype.render=function(){return this.arbiter.render()},e.exports=s}),define("famous/widgets/TabBar",["require","exports","module","famous/utilities/Utility","famous/core/View","famous/views/GridLayout","./ToggleButton"],function(t,i,e){function s(){a.apply(this,arguments),this.layout=new h,this.buttons=[],this._buttonIds={},this._buttonCallbacks={},this.layout.sequenceFrom(this.buttons),this._add(this.layout),this._optionsManager.on("change",o.bind(this))}function o(t){var i=t.id,e=t.value;if("direction"===i)this.layout.setOptions({dimensions:n.call(this.buttons.length,this.options.direction)});else if("buttons"===i)for(var s in this.buttons)this.buttons[s].setOptions(e);else if("sections"===i)for(var o in this.options.sections)this.defineSection(o,this.options.sections[o]) +}function n(t,i){return i===r.Direction.X?[t,1]:[1,t]}var r=t("famous/utilities/Utility"),a=t("famous/core/View"),h=t("famous/views/GridLayout"),u=t("./ToggleButton");s.prototype=Object.create(a.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS={sections:[],widget:u,size:[void 0,50],direction:r.Direction.X,buttons:{toggleMode:u.ON}},s.prototype.defineSection=function(t,i){var e,s=this._buttonIds[t];if(void 0===s){s=this.buttons.length,this._buttonIds[t]=s;var o=this.options.widget;e=new o,this.buttons[s]=e,this.layout.setOptions({dimensions:n(this.buttons.length,this.options.direction)})}else e=this.buttons[s],e.unbind("select",this._buttonCallbacks[t]);this.options.buttons&&e.setOptions(this.options.buttons),e.setOptions(i),this._buttonCallbacks[t]=this.select.bind(this,t),e.on("select",this._buttonCallbacks[t])},s.prototype.select=function(t){var i=this._buttonIds[t];this.buttons[i]&&this.buttons[i].isSelected()?this._eventOutput.emit("select",{id:t}):this.buttons[i]&&this.buttons[i].select();for(var e=0;ey&&y>u&&(s.set(o.normalize(n*d*p(y,h)).cap(a)),f.applyForce(s))}}},e.exports=s}),define("famous/physics/forces/RotationalDrag",["require","exports","module","./Drag"],function(t,i,e){function s(t){o.call(this,t)}var o=t("./Drag");s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.DEFAULT_OPTIONS=o.DEFAULT_OPTIONS,s.FORCE_FUNCTIONS=o.FORCE_FUNCTIONS,s.FORCE_FUNCTIONS={LINEAR:function(t){return t},QUADRATIC:function(t){return t.mult(t.norm())}},s.prototype.applyForce=function(t){for(var i=this.options.strength,e=this.options.forceFunction,s=this.force,o=0;ow){if(p.set(l.normalize()),this._eventOutput){var E={target:_,source:i,overlap:w,normal:p};this._eventOutput.emit("preCollision",E),this._eventOutput.emit("collision",E)}var I=u>=w?((1+c)*p.dot(f)+h/e*(w-u))/(x+e/b):(1+c)*p.dot(f)/(x+e/b);p.mult(e*I).put(d),d.mult(-1).put(m),i.applyImpulse(d),_.applyImpulse(m),this._eventOutput&&this._eventOutput.emit("postCollision",E)}}}},e.exports=s}),define("famous/physics/constraints/Curve",["require","exports","module","./Constraint","famous/math/Vector"],function(t,i,e){function s(t){this.options=Object.create(s.DEFAULT_OPTIONS),t&&this.setOptions(t),this.J=new n,this.impulse=new n,o.call(this)}var o=t("./Constraint"),n=t("famous/math/Vector");s.prototype=Object.create(o.prototype),s.prototype.constructor=s;var r=1e-7,a=Math.PI;s.DEFAULT_OPTIONS={equation:function(){return 0},plane:function(t,i,e){return e},period:0,dampingRatio:0},s.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},s.prototype.applyConstraint=function(t,i,e){for(var s=this.options,o=this.impulse,n=this.J,h=s.equation,u=s.plane,c=s.dampingRatio,p=s.period,l=0;l' + + '' + + '
    ' + + 'Powered by Barometer' + + '
    ' + + '' + + '
    ' + + '
    ' + + '
    ' + + ''; + + document.write(this.tab_html); + document.write(this.overlay_html); +}; + +BAROMETER.show = function() { + document.getElementById('barometer_iframe').setAttribute("src", this.feedback_url); + document.getElementById('barometer_overlay').style.display = "block"; + return false; +}; \ No newline at end of file diff --git a/app/assets/javascripts/require/require.js b/app/assets/javascripts/require/require.js new file mode 100644 index 00000000..e599a6ab --- /dev/null +++ b/app/assets/javascripts/require/require.js @@ -0,0 +1,36 @@ +/* + RequireJS 2.1.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details +*/ +var requirejs,require,define; +(function(ca){function G(b){return"[object Function]"===M.call(b)}function H(b){return"[object Array]"===M.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& +(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= +this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); +if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", +"fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, +a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(N,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, +nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, +a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= +!0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(N,f))return N[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}L();i.nextTick(function(){L();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== +d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): +(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,L=g,D?y.insertBefore(g,D):y.appendChild(g),L=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(K=b.getAttribute("data-main"))return q=K,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= +Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=K),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=L))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| +(b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); diff --git a/app/assets/javascripts/shims/classList.js b/app/assets/javascripts/shims/classList.js new file mode 100644 index 00000000..0cf197c0 --- /dev/null +++ b/app/assets/javascripts/shims/classList.js @@ -0,0 +1,138 @@ + +/* + * classList.js: Cross-browser full element.classList implementation. + * 2011-06-15 + * + * By Eli Grey, http://eligrey.com + * Public Domain. + * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + */ + +/*global self, document, DOMException */ + +/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ + +if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) { + +(function (view) { + +"use strict"; + +var + classListProp = "classList" + , protoProp = "prototype" + , elemCtrProto = (view.HTMLElement || view.Element)[protoProp] + , objCtr = Object + , strTrim = String[protoProp].trim || function () { + return this.replace(/^\s+|\s+$/g, ""); + } + , arrIndexOf = Array[protoProp].indexOf || function (item) { + var + i = 0 + , len = this.length + ; + for (; i < len; i++) { + if (i in this && this[i] === item) { + return i; + } + } + return -1; + } + // Vendors: please allow content code to instantiate DOMExceptions + , DOMEx = function (type, message) { + this.name = type; + this.code = DOMException[type]; + this.message = message; + } + , checkTokenAndGetIndex = function (classList, token) { + if (token === "") { + throw new DOMEx( + "SYNTAX_ERR" + , "An invalid or illegal string was specified" + ); + } + if (/\s/.test(token)) { + throw new DOMEx( + "INVALID_CHARACTER_ERR" + , "String contains an invalid character" + ); + } + return arrIndexOf.call(classList, token); + } + , ClassList = function (elem) { + var + trimmedClasses = strTrim.call(elem.className) + , classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [] + , i = 0 + , len = classes.length + ; + for (; i < len; i++) { + this.push(classes[i]); + } + this._updateClassName = function () { + elem.className = this.toString(); + }; + } + , classListProto = ClassList[protoProp] = [] + , classListGetter = function () { + return new ClassList(this); + } +; +// Most DOMException implementations don't allow calling DOMException's toString() +// on non-DOMExceptions. Error's toString() is sufficient here. +DOMEx[protoProp] = Error[protoProp]; +classListProto.item = function (i) { + return this[i] || null; +}; +classListProto.contains = function (token) { + token += ""; + return checkTokenAndGetIndex(this, token) !== -1; +}; +classListProto.add = function (token) { + token += ""; + if (checkTokenAndGetIndex(this, token) === -1) { + this.push(token); + this._updateClassName(); + } +}; +classListProto.remove = function (token) { + token += ""; + var index = checkTokenAndGetIndex(this, token); + if (index !== -1) { + this.splice(index, 1); + this._updateClassName(); + } +}; +classListProto.toggle = function (token) { + token += ""; + if (checkTokenAndGetIndex(this, token) === -1) { + this.add(token); + } else { + this.remove(token); + } +}; +classListProto.toString = function () { + return this.join(" "); +}; + +if (objCtr.defineProperty) { + var classListPropDesc = { + get: classListGetter + , enumerable: true + , configurable: true + }; + try { + objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); + } catch (ex) { // IE 8 doesn't support enumerable:true + if (ex.number === -0x7FF5EC54) { + classListPropDesc.enumerable = false; + objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); + } + } +} else if (objCtr[protoProp].__defineGetter__) { + elemCtrProto.__defineGetter__(classListProp, classListGetter); +} + +}(self)); + +} diff --git a/app/assets/javascripts/shims/functionPrototypeBind.js b/app/assets/javascripts/shims/functionPrototypeBind.js new file mode 100644 index 00000000..c9d7a41d --- /dev/null +++ b/app/assets/javascripts/shims/functionPrototypeBind.js @@ -0,0 +1,23 @@ +if (!Function.prototype.bind) { + Function.prototype.bind = function (oThis) { + if (typeof this !== "function") { + // closest thing possible to the ECMAScript 5 internal IsCallable function + throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); + } + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function () {}, + fBound = function () { + return fToBind.apply(this instanceof fNOP && oThis + ? this + : oThis, + aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + }; +} diff --git a/app/assets/javascripts/shims/requestAnimationFrame.js b/app/assets/javascripts/shims/requestAnimationFrame.js new file mode 100644 index 00000000..4ab22330 --- /dev/null +++ b/app/assets/javascripts/shims/requestAnimationFrame.js @@ -0,0 +1,13 @@ +// adds requestAnimationFrame functionality +// Source: http://strd6.com/2011/05/better-window-requestanimationframe-shim/ + +window.requestAnimationFrame || (window.requestAnimationFrame = + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function(callback, element) { + return window.setTimeout(function() { + callback(+new Date()); + }, 1000 / 60); +}); diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js b/app/assets/javascripts/src/Metamaps.GlobalUI.js index a425d78f..97435893 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js @@ -533,6 +533,7 @@ Metamaps.GlobalUI.Search = { if (dataset.length == 0) { dataset.push({ profile: "/assets/user.png", + value: "No results", label: "No results", rtype: "noresult" @@ -591,14 +592,12 @@ Metamaps.GlobalUI.Search = { if (s.css('height') == '0px') { s.css({ 'height': 'auto', - 'border-top': 'none', 'overflow': 'visible' }); $(this).removeClass('maximizeResults').addClass('minimizeResults'); } else { s.css({ 'height': '0', - 'border-top': '1px solid rgb(56, 56, 56)', 'overflow': 'hidden' }); $(this).removeClass('minimizeResults').addClass('maximizeResults'); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 8ae9967a..bb8c1323 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -10,9 +10,6 @@ * *= require_self *= require_tree . - *= require base - *= require jquery.mCustomScrollbar - *= require jquery-ui */ /* clear styles */ diff --git a/app/assets/stylesheets/barometer.css b/app/assets/stylesheets/barometer.css new file mode 100644 index 00000000..fbc21d3f --- /dev/null +++ b/app/assets/stylesheets/barometer.css @@ -0,0 +1,151 @@ +/* =Barometer feedback tab +--------------------------------------------------------*/ + +a#barometer_tab { + background-image:url(../images/feedback_tab.png); + background-color:#222222; + color:#FFFFFF; + cursor:pointer; + height:102px; + left:0; + margin-left:-7px; + overflow:hidden; + position:fixed; + text-indent:-100000px; + top:25%; + width:42px; + z-index:100000; + } + +/* =Barometer Overlay +--------------------------------------------------------*/ + +#barometer_overlay { + top:0; + left:0; + width: 100%; + height: 100%; + position: fixed; + _position: absolute; + z-index: 1000000; + } + +#barometer_overlay * { + margin: 0; + padding: 0; + font-family: Arial, Helvetica, sans-serif; + font-style:normal; + font-variant:normal; + font-size: 12px; + color:#333; + } + +/* =Barometer Overlay -> Main +--------------------------------------------------------*/ + +#barometer_main { + width: 550px; + height: 100%; + margin: 0 auto; + z-index:2; + position:relative; + background-color: transparent; + } + +#barometer_main div { + padding: 5px 20px 0 20px; + margin:0; + background: #EEE; + overflow:none; + border-right: solid 2px #000; + border-left: solid 2px #000; + } + +#barometer_overlay #barometer_main #overlay_loading h2 { + padding: 10px 0; + font-size:28px; + } + +#barometer_overlay #barometer_main #barometer_close:hover { + background-position:-42px 0; + } + +#barometer_overlay #barometer_main a#barometer_close { + background-image:url(../images/barometer_close.png); + cursor:pointer; + height:42px; + outline-color:-moz-use-text-color; + outline-style:none; + outline-width:medium; + overflow:hidden; + position:absolute; + top:-23px; + right:-22px; + width:42px; + z-index:4; + border: none; + } + +#barometer_overlay #barometer_main span { + background:url(../images/close.png) no-repeat scroll 33px 0 transparent; + color:#FFFFFF; + cursor:pointer; + float:right; + font-size:11px; + height:20px; + padding-right:20px; + text-decoration:underline; +} + +#barometer_iframe { + width: 550px; + height: 100%; + background: transparent url(../images/barometer_loading.png) no-repeat; +} +#barometer_iframe.loaded { + background: transparent; +} + + +/* =Barometer Overlay -> Main -> Overlay header +--------------------------------------------------------*/ + +#barometer_overlay #barometer_main #overlay_header { + padding:6px 5px 1px 0; + background-color:#333; + font-weight: bold; + height:18px; + border: solid 2px #000; + } + +#barometer_overlay #barometer_main #overlay_header a { + color:#fff; + float:left; + font-size:15px; + margin-left:5px; + font-weight: normal; + } + +#barometer_overlay #barometer_main #overlay_header span { + float:right; + height:20px; + padding-right:20px; + background: transparent url(../images/close.png) no-repeat 33px 0; + text-decoration:underline; + font-size:11px; + cursor:pointer; + color: #fff; + } + +/* =Barometer screen id - used to close barometer +--------------------------------------------------------*/ + +#barometer_screen { + top:0; + left:0; + z-index:1; + width: 100%; + position: absolute; + background-color: #000; + opacity: 0.42; filter:alpha(opacity=42); -moz-opacity: 0.42; + } \ No newline at end of file diff --git a/app/assets/stylesheets/clean.css b/app/assets/stylesheets/clean.css index 918af0c3..8392699f 100644 --- a/app/assets/stylesheets/clean.css +++ b/app/assets/stylesheets/clean.css @@ -212,6 +212,7 @@ .searchHeader { height: 42px; width: 100%; + position: relative; } .searchTopicsHeader { background: #4fc4a8; @@ -227,35 +228,44 @@ color: #F5F5F5; font-size: 18px; line-height: 18px; - margin: 10px 0 3px 10px; + margin: 12px 0 3px 16px; float: left; } .sidebarSearch .tt-dropdown-menu .limitToMe { float: left; - width: 15px; - height: 15px; - margin-top: 11px; - margin-left: 15px; + width: 12px; + height: 12px; + border: 1px; + color: #000000; + position: absolute; + top: 15px; + left: 136px; } .sidebarSearch .tt-dropdown-menu .limitToMeLabel { float: left; - margin-top: 11px; + font-family: 'din-medium', helvetica, sans-serif; + font-size: 12px; + color: #f5f5f5; + margin: 0; + position: absolute; + top: 15px; + left: 156px; +} +.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults { + float: right; + width: 32px; + height: 32px; + background-image: url(arrowpermswhite_sprite.png); + background-repeat: no-repeat; + cursor: pointer; + margin-top: 5px; + margin-right: 20px; } .sidebarSearch .tt-dropdown-menu .minimizeResults { - float: right; - width: 35px; - height: 35px; - background: url('/assets/MMCCicon_minimize_arrow.png') no-repeat center center; - background-size: 25px 25px; - cursor: pointer; + background-position-x: 0; } .sidebarSearch .tt-dropdown-menu .maximizeResults { - float: right; - width: 35px; - height: 35px; - background: url('/assets/MMCCicon_maximize_arrow.png') no-repeat center center; - background-size: 25px 25px; - cursor: pointer; + background-position-x: -32px; } .sidebarSearch .tt-suggestions { overflow: visible; @@ -292,7 +302,7 @@ .sidebarSearch .tt-dataset-topics .tt-is-under-cursor .topicIcon, .sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .topicIcon { margin: 0 auto; - padding-left: 2px + padding-left: 10px; } .sidebarSearch .tt-dataset-topics .metacodeTip { display: none; @@ -311,7 +321,7 @@ margin: 4px 9px 4px 4px; } .sidebarSearch .resultText { - width: 225px; + width: 260px; display: block; float: left; word-wrap: break-word; @@ -355,14 +365,19 @@ outline: none; } .sidebarSearch button.addToMap { - width: 20px; - height: 20px; - background: url(/assets/MMCCicon_add.png) no-repeat center center; - background-size: 18px 18px; - top: 30px; + width: 24px; + height: 24px; + background: url(addtopic_sprite.png); + background-repeat: no-repeat; + background-size: 48px 24px; + top: 19px; left: 84px; cursor: pointer; } +.sidebarSearch button.addToMap:hover { + background-position: -24px; +} +/* .sidebarSearch div.goTo { width: 20px; height: 20px; @@ -370,25 +385,28 @@ background-size: 18px 18px; top: 7px; left: 84px; -} -.sidebarSearch div.mapCount { - width: 20px; - height: 20px; - background: url(/assets/MMCCicon_map.png) no-repeat 0px center; - background-size: 14px 14px; +}*/ +.sidebarSearch div.topicCount { + width: 16px; + height: 16px; + background: url(topic16.png); + background-repeat: no-repeat; + background-size: 16px 16px; top: 7px; - left: 38px; + left: 13px; padding-left: 18px; font-size: 12px; line-height: 20px; } -.sidebarSearch div.topicCount { + +.sidebarSearch div.mapCount { width: 20px; height: 20px; - background: url(/assets/MMCCicon_topic.png) no-repeat 0px center; + background: url(metamap16.png); + background-repeat: no-repeat; background-size: 14px 14px; top: 7px; - left: 39px; + left: 13px; padding-left: 18px; font-size: 12px; line-height: 20px; @@ -396,21 +414,20 @@ .sidebarSearch div.synapseCount { width: 20px; height: 20px; - background: url(/assets/MMCCicon_synapse.png) no-repeat 0px center; + background: url(synapse16.png); + background-repeat: no-repeat; background-size: 15px 15px; top: 30px; - left: 38px; + left: 13px; padding-left: 19px; font-size: 12px; line-height: 20px; } .sidebarSearch div.topicOriginatorIcon { - width: 20px; - height: 20px; - background: url(/assets/MMCCicon_mapper.png) no-repeat center center; - background-size: 17px 17px; + width: 24px; + height: 24px; top: 7px; - left: 13px; + left: 47px; } .sidebarSearch .tip { position: absolute; @@ -444,10 +461,11 @@ } .sidebarSearch div.mapContributorsIcon { height: 20px; - background: url(/assets/MMCCicon_mapper.png) no-repeat 0px center; + background: url(/assets/MMCCicon_mapper.png); + background-repeat: no-repeat; background-size: 17px 17px; top: 7px; - right: 85px; + right: 25px; padding-left: 19px; font-size: 12px; line-height: 20px; @@ -455,24 +473,27 @@ } .sidebarSearch div.topicPermission, .sidebarSearch div.mapPermission { - width: 20px; - height: 20px; - background-size: 19px 19px !important; - top: 30px; - left: 13px; + width: 24px; + height: 24px; + background-image: url(permissions32_sprite.png); + background-repeat: no-repeat; + background-size: 72px 48px !important; + top: 27px; + left: 47px; } .sidebarSearch div.topicPermission.commons, .sidebarSearch div.mapPermission.commons { - background: url(/assets/MMCCicon_commons.png) no-repeat center center; + background-position: 0 0; } .sidebarSearch div.topicPermission.public, .sidebarSearch div.mapPermission.public { - background: url(/assets/MMCCicon_public.png) no-repeat center center; + background-position: -32px 0; } .sidebarSearch div.topicPermission.private, .sidebarSearch div.mapPermission.private { - background: url(/assets/MMCCicon_private.png) no-repeat center center; + background-position: -16px 0; } + .sidebarSearch .tt-dataset-mappers a.goTo { top: 7px; } diff --git a/app/assets/stylesheets/famous.css b/app/assets/stylesheets/famous.css new file mode 100644 index 00000000..d806be45 --- /dev/null +++ b/app/assets/stylesheets/famous.css @@ -0,0 +1,77 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Owner: mark@famo.us + * @license MPL 2.0 + * @copyright Famous Industries, Inc. 2014 + */ + + +html { + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + overflow: hidden; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; +} + +body { + position: absolute; + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -webkit-font-smoothing: antialiased; + -webkit-tap-highlight-color: transparent; + -webkit-perspective: 0; + perspective: none; + overflow: hidden; +} + +.famous-container, .famous-group { + position: absolute; + top: 0px; + left: 0px; + bottom: 0px; + right: 0px; + overflow: visible; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -webkit-backface-visibility: visible; + backface-visibility: visible; + pointer-events: none; +} + +.famous-group { + width: 0px; + height: 0px; + margin: 0px; + padding: 0px; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; +} + +.famous-surface { + position: absolute; + -webkit-transform-origin: center center; + transform-origin: center center; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-transform-style: flat; + transform-style: preserve-3d; /* performance */ + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-tap-highlight-color: transparent; + pointer-events: auto; +} + +.famous-container-group { + position: relative; + width: 100%; + height: 100%; +} diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb index 84c0d9a7..05cbc974 100644 --- a/app/helpers/topics_helper.rb +++ b/app/helpers/topics_helper.rb @@ -8,7 +8,7 @@ module TopicsHelper topic['id'] = t.id topic['label'] = t.name topic['value'] = t.name - topic['description'] = t.desc.truncate(35) # make this return matched results + topic['description'] = t.desc.truncate(70) # make this return matched results topic['type'] = t.metacode.name topic['typeImageURL'] = t.metacode.icon topic['permission'] = t.permission diff --git a/app/views/layouts/_templates.html.erb b/app/views/layouts/_templates.html.erb index 4a796e18..dead8f9f 100644 --- a/app/views/layouts/_templates.html.erb +++ b/app/views/layouts/_templates.html.erb @@ -83,9 +83,6 @@ add to map <% end %> -
    - open in new tab -
    appears on this # of maps {{mapCount}} @@ -95,7 +92,8 @@ {{synapseCount}}
    - created by {{originator}} + + created by {{originator}}
    topic is {{permission}} @@ -146,6 +144,14 @@
    open in new tab
    +
    + Mapping since: + {{create_at}} +
    +
    + Generation + {{mapCount}} +
    created this # of maps {{mapCount}} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9e17a43d..478381d2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -18,18 +18,6 @@ - - - - - - - - - - - -