summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/editor')
-rw-r--r--public/assets/javascripts/ui/editor/EditorSettings.js2
-rw-r--r--public/assets/javascripts/ui/editor/HelpCursor.js54
-rw-r--r--public/assets/javascripts/ui/editor/LightControl.js2
-rw-r--r--public/assets/javascripts/ui/editor/MediaViewer.js4
-rw-r--r--public/assets/javascripts/ui/editor/Presets.js2
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js2
6 files changed, 41 insertions, 25 deletions
diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js
index e47739b..c0c140f 100644
--- a/public/assets/javascripts/ui/editor/EditorSettings.js
+++ b/public/assets/javascripts/ui/editor/EditorSettings.js
@@ -122,7 +122,7 @@ var EditorSettings = FormView.extend({
$(".inuse").removeClass("inuse")
$("[data-role='toggle-project-settings']").toggleClass("inuse", state)
if (state) {
- this.parent.cursor.show("settings")
+ this.parent.cursor.message("settings")
}
},
diff --git a/public/assets/javascripts/ui/editor/HelpCursor.js b/public/assets/javascripts/ui/editor/HelpCursor.js
index 4a6e616..8bfaef8 100644
--- a/public/assets/javascripts/ui/editor/HelpCursor.js
+++ b/public/assets/javascripts/ui/editor/HelpCursor.js
@@ -2,6 +2,8 @@
var HelpCursor = View.extend({
el: "#helpCursor",
+ active: false,
+
messages: {
start: "Welcome to Vvalls! Click one of the tools at right to learn how it works.",
media: "This is where you pick media to go on the walls. You can upload media, paste links, or use some of the found media.",
@@ -10,33 +12,47 @@ var HelpCursor = View.extend({
colors: "Use these colors to change the color of the walls, floor, and ceiling.",
settings: "This is where you publish your project. Give it a name, hit save, and you'll have a URL you can share with your friends.",
},
- shown: {},
initialize: function(){
- $(window).mousemove(function(e){
- this.el.style.left = e.pageX + "px"
- this.el.style.top = e.pageY + "px"
- }.bind(this))
- this.show("start")
+ $('#help-button').click(this.toggle.bind(this));
},
-
- show: function(name){
- this.showMessage(name)
+
+ toggle: function(){
+ this.active ? this.stop() : this.start()
+ },
+
+ start: function(){
+ if (this.active) return
+ this.active = true
+ this.message('start')
this.$el.show()
+// $('body').chardinJs('start')
+// $(window).one("click", function(){
+// $('body').chardinJs('stop')
+// })
+ this.move({ pageX: -1000, pageY: -10000 })
+ this.moveFn = this.move.bind(this)
+ document.addEventListener("mousemove", this.moveFn)
},
-
- hide: function(){
+
+ stop: function(){
+ this.active = false
this.$el.hide()
+ document.removeEventListener("mousemove", this.moveFn)
+ },
+
+ move: function(e){
+ this.el.style.left = e.pageX + "px"
+ this.el.style.top = e.pageY + "px"
+ },
+
+ show: function(name){
+ this.showMessage(name)
},
- showMessage: function(name){
- if (+(this.shown[name] || 0) < 2) {
- this.$el.html(this.messages[name])
- this.shown[name] = (+this.shown[name] || 0) + 1
- }
- else {
- this.$el.html("")
- }
+ message: function(name){
+ if (! this.active) return
+ this.$el.html(this.messages[name])
},
})
diff --git a/public/assets/javascripts/ui/editor/LightControl.js b/public/assets/javascripts/ui/editor/LightControl.js
index bb4454a..10f8d2c 100644
--- a/public/assets/javascripts/ui/editor/LightControl.js
+++ b/public/assets/javascripts/ui/editor/LightControl.js
@@ -77,7 +77,7 @@ var LightControl = View.extend({
},
show: function(){
- this.parent.cursor.show("colors")
+ this.parent.cursor.message("colors")
this.toggle(true)
},
diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js
index df77fb1..e196e41 100644
--- a/public/assets/javascripts/ui/editor/MediaViewer.js
+++ b/public/assets/javascripts/ui/editor/MediaViewer.js
@@ -68,7 +68,7 @@ var MediaViewer = ModalView.extend({
this.loadTrending()
}
else {
- this.parent.cursor.show("media")
+ this.parent.cursor.message("media")
this.__super__.show.call(this)
}
},
@@ -147,7 +147,7 @@ var MediaViewer = ModalView.extend({
}
else {
this.loaded = true
- this.parent.cursor.show("media")
+ this.parent.cursor.message("media")
this.__super__.show.call(this)
}
},
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js
index 6222e33..35b5b58 100644
--- a/public/assets/javascripts/ui/editor/Presets.js
+++ b/public/assets/javascripts/ui/editor/Presets.js
@@ -43,7 +43,7 @@ var Presets = View.extend({
},
show: function(){
- this.parent.cursor.show("presets")
+ this.parent.cursor.message("presets")
this.toggle(true)
},
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index 9583376..ad30ad8 100644
--- a/public/assets/javascripts/ui/editor/WallpaperPicker.js
+++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js
@@ -29,7 +29,7 @@ var WallpaperPicker = UploadView.extend({
loaded: false,
show: function(){
if (! this.loaded) {
- this.parent.cursor.show("wallpaper")
+ this.parent.cursor.message("wallpaper")
this.load()
}
else {