summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui')
-rw-r--r--public/assets/javascripts/ui/editor/ColorControl.js6
-rw-r--r--public/assets/javascripts/ui/editor/HelpCursor.js15
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js46
3 files changed, 38 insertions, 29 deletions
diff --git a/public/assets/javascripts/ui/editor/ColorControl.js b/public/assets/javascripts/ui/editor/ColorControl.js
index 61a7ef6..459ac1e 100644
--- a/public/assets/javascripts/ui/editor/ColorControl.js
+++ b/public/assets/javascripts/ui/editor/ColorControl.js
@@ -29,7 +29,7 @@ var ColorControl = View.extend({
initialize: function(opt){
this.parent = opt.parent
- this.colorPicker = new LabColorPicker(this, 180, 180)
+ this.colorPicker = new LabColorPicker(this, 155, 155)
this.$("#color-picker").append( this.colorPicker.canvas )
this.$("#color-picker").append( this.colorPicker.cursor )
@@ -73,11 +73,13 @@ var ColorControl = View.extend({
},
toggle: function(state){
+ if (state) {
+ this.parent.cursor.message("colors")
+ }
this.$el.toggleClass("active", state);
},
show: function(){
- this.parent.cursor.message("colors")
this.toggle(true)
},
diff --git a/public/assets/javascripts/ui/editor/HelpCursor.js b/public/assets/javascripts/ui/editor/HelpCursor.js
index 3bcfd7a..d0e1825 100644
--- a/public/assets/javascripts/ui/editor/HelpCursor.js
+++ b/public/assets/javascripts/ui/editor/HelpCursor.js
@@ -43,9 +43,12 @@ var HelpCursor = View.extend({
document.removeEventListener("mousemove", this.moveFn)
},
+ offset: 100,
+ lastPosition: { pageX: 0, pageY: 0 },
move: function(e){
- this.el.style.left = e.pageX + "px"
+ this.el.style.right = clamp(window.innerWidth - e.pageX, this.offset, window.innerWidth) + "px"
this.el.style.top = e.pageY + "px"
+ this.lastPosition = e
},
show: function(name){
@@ -54,6 +57,16 @@ var HelpCursor = View.extend({
message: function(name){
if (! this.active) return
+ if (name == "start" || name == "media" || name == "settings") {
+ this.offset = 100
+ }
+ else if (name == "colors") {
+ this.offset = 270
+ }
+ else {
+ this.offset = 290
+ }
+ this.move(this.lastPosition)
this.$el.html(this.messages[name])
},
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index 6bcd859..afdfca7 100644
--- a/public/assets/javascripts/ui/editor/WallpaperPicker.js
+++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js
@@ -28,19 +28,28 @@ var WallpaperPicker = UploadView.extend({
loaded: false,
show: function(){
- if (! this.loaded) {
- this.parent.cursor.message("wallpaper")
- this.load()
- }
- else {
- this.toggle(true)
- }
+ this.toggle(true)
},
-
hide: function(){
- this.__super__.hide.call(this)
+ this.toggle(false)
},
-
+// hide: function(){
+// this.__super__.hide.call(this)
+// },
+
+ toggle: function (state) {
+ app.tube('cancel-wallpaper')
+ this.$el.toggleClass("active", state)
+ if (state) {
+ this.parent.cursor.message("wallpaper")
+ if (! this.loaded) {
+ this.load()
+ }
+ }
+ // toggle the class that makes the cursor a paintbucket
+ // $("body").removeClass("pastePaper")
+ },
+
load: function(){
$.get("/api/media/user", { tag: this.mediaTag }, this.populate.bind(this))
},
@@ -86,21 +95,6 @@ var WallpaperPicker = UploadView.extend({
}.bind(this))
},
- toggle: function (state) {
- if (state && ! this.loaded) {
- this.show()
- }
- else {
- this.$el.toggleClass("active", state)
- }
- // toggle the class that makes the cursor a paintbucket
- // $("body").removeClass("pastePaper")
- },
-
- hide: function(){
- this.toggle(false)
- },
-
beforeUpload: function(){
},
@@ -145,7 +139,7 @@ var WallpaperPicker = UploadView.extend({
$floatingSwatch.removeClass("scissors").hide()
}
$(window).on('mousemove', _followCursor)
- $(window).one('click', _hideCursor);
+ // $(window).one('click', _hideCursor);
app.on('cancel-wallpaper', _hideCursor)
$floatingSwatch.show()
_followCursor(e);