diff options
| -rw-r--r-- | public/assets/javascripts/ui/editor/EditorToolbar.js | 42 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/EditorView.js | 1 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/LightControl.js | 34 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/Presets.js | 59 | ||||
| -rwxr-xr-x | public/assets/stylesheets/app.css | 6 | ||||
| -rw-r--r-- | views/controls/editor/presets.ejs | 2 | ||||
| -rw-r--r-- | views/partials/scripts.ejs | 1 |
7 files changed, 83 insertions, 62 deletions
diff --git a/public/assets/javascripts/ui/editor/EditorToolbar.js b/public/assets/javascripts/ui/editor/EditorToolbar.js index 49decc2..4f12a7b 100644 --- a/public/assets/javascripts/ui/editor/EditorToolbar.js +++ b/public/assets/javascripts/ui/editor/EditorToolbar.js @@ -7,8 +7,8 @@ var EditorToolbar = View.extend({ "click [data-role='toggle-map-view']": 'toggleMap', "click [data-role='toggle-project-settings']": 'toggleSettings', "click [data-role='open-media-viewer']": 'openMediaViewer', -// "click [data-role='resize-media']": 'resizeMedia', - "click [data-role='destroy-media']": 'destroyMedia', + "click [data-role='toggle-presets']": 'togglePresets', +// "click [data-role='destroy-media']": 'destroyMedia', "click [data-role='toggle-wallpaper-panel']": 'toggleWallpaper', "click [data-role='toggle-light-control']": 'toggleLightControl', "click [data-role='toggle-text-editor']": 'toggleTextEditor', @@ -26,6 +26,7 @@ var EditorToolbar = View.extend({ toggleSettings: function(){ // this.resetMode() this.parent.textEditor.hide() + this.parent.presets.hide() this.parent.lightControl.hide() this.parent.wallpaperPicker.hide() this.parent.mediaEditor.hide() @@ -52,6 +53,7 @@ var EditorToolbar = View.extend({ $(".inuse").removeClass("inuse") this.parent.textEditor.hide() this.parent.wallpaperPicker.hide() + this.parent.presets.hide() this.parent.lightControl.hide() this.parent.settings.hide() }, @@ -62,28 +64,6 @@ var EditorToolbar = View.extend({ editor.permissions.add("resize") editor.permissions.remove("destroy") }, - -// resizeMedia: function(e, state){ -// this.resetControls() -// if (! state && typeof e == "boolean") { -// state = e -// editor.permissions.assign("resize", state) -// } -// else { -// state = editor.permissions.toggle("resize") -// } -// ! state && editor.permissions.assign("move", true) -// $(".inuse").removeClass("inuse") -// $("[data-role='resize-media']").toggleClass("inuse", state) -// if (state) { -// if (this.parent.mediaEditor.scenery) { -// Scenery.resize.show( this.parent.mediaEditor.scenery ) -// } -// } -// else { -// Scenery.resize.hide() -// } -// }, destroyMedia: function(e, state){ this.resetControls() @@ -113,6 +93,7 @@ var EditorToolbar = View.extend({ this.parent.lightControl.hide() this.parent.textEditor.hide() this.parent.settings.hide() + this.parent.presets.hide() this.parent.wallpaperPicker.toggle(state) }, @@ -124,6 +105,7 @@ var EditorToolbar = View.extend({ this.parent.wallpaperPicker.hide() this.parent.textEditor.hide() this.parent.settings.hide() + this.parent.presets.hide() this.parent.lightControl.toggle(state) }, @@ -135,9 +117,21 @@ var EditorToolbar = View.extend({ this.parent.wallpaperPicker.hide() this.parent.lightControl.hide() this.parent.settings.hide() + this.parent.presets.hide() this.parent.textEditor.toggle(state) }, + togglePresets: function(){ + var state = ! $("[data-role='toggle-presets']").hasClass("inuse") + this.resetMode() + $("[data-role='toggle-presets']").toggleClass("inuse", state) + this.parent.mediaEditor.hide() + this.parent.wallpaperPicker.hide() + this.parent.textEditor.hide() + this.parent.settings.hide() + this.parent.lightControl.hide() + this.parent.presets.toggle(state) + }, }) var editor = new function(){ diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js index f60b149..b35c872 100644 --- a/public/assets/javascripts/ui/editor/EditorView.js +++ b/public/assets/javascripts/ui/editor/EditorView.js @@ -18,6 +18,7 @@ var EditorView = View.extend({ this.lightControl = new LightControl ({ parent: this }) this.textEditor = new TextEditor ({ parent: this }) this.collaborators = new Collaborators ({ parent: this }) + this.presets = new Presets ({ parent: this }) }, load: function(name){ diff --git a/public/assets/javascripts/ui/editor/LightControl.js b/public/assets/javascripts/ui/editor/LightControl.js index 6100762..3eb2861 100644 --- a/public/assets/javascripts/ui/editor/LightControl.js +++ b/public/assets/javascripts/ui/editor/LightControl.js @@ -10,7 +10,6 @@ var LightControl = View.extend({ "input #brightness-control": "updateBrightness", "input #outline-hue": "updateShadow", "input #wall-hue": "updateShadow", - "click .presets span": "selectPreset", }, initialize: function(){ @@ -115,39 +114,6 @@ var LightControl = View.extend({ this.setMode(mode) }, - presets: { - wireframe: { - wall: [255,255,255], - outline: [0,0,0], - floor: [246,246,246], - ceiling: [255,255,255], - }, - shaded: { - wall: [205,205,204], - outline: [0,0,0], - floor: [109,116,106], - ceiling: [159,163,157], - }, - pfunk: { - wall: [255,63,78], - outline: [255,246,0], - floor: [255,255,0], - ceiling: [225,118,252], - }, - inverse: { - wall: [0,0,0], - outline: [255,255,255], - floor: [0,0,0], - ceiling: [0,0,0], - }, - }, - selectPreset: function(e){ - var preset = $(e.currentTarget).data('preset') - if (! this.presets[preset]) return - this.load(this.presets[preset]) - $(e.currentTarget).addClass('active') - }, - beginBrightness: function(){ this.begin() $(window).one("mouseup", this.finalize.bind(this)) diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js new file mode 100644 index 0000000..a7e92b6 --- /dev/null +++ b/public/assets/javascripts/ui/editor/Presets.js @@ -0,0 +1,59 @@ +var Presets = View.extend({ + el: "#presets", + + events: { + "click .presets span": "selectPreset", + }, + + presets: { + wireframe: { + wall: [255,255,255], + outline: [0,0,0], + floor: [246,246,246], + ceiling: [255,255,255], + }, + shaded: { + wall: [205,205,204], + outline: [0,0,0], + floor: [109,116,106], + ceiling: [159,163,157], + }, + pfunk: { + wall: [255,63,78], + outline: [255,246,0], + floor: [255,255,0], + ceiling: [225,118,252], + }, + inverse: { + wall: [0,0,0], + outline: [255,255,255], + floor: [0,0,0], + ceiling: [0,0,0], + }, + }, + + initialize: function(opt){ + this.parent = opt.parent + }, + + toggle: function(state){ + this.$el.toggleClass("active", state); + }, + + show: function(){ + this.toggle(true) + }, + + hide: function(){ + this.toggle(false) + }, + + selectPreset: function(e){ + var preset = $(e.currentTarget).data('preset') + if (! this.presets[preset]) return + this.parent.lightControl.load(this.presets[preset]) + this.$(".active").removeClass('active') + $(e.currentTarget).addClass('active') + }, + +})
\ No newline at end of file diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index a40c131..4bae1de 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -1430,7 +1430,7 @@ border-left: 1px solid black; /* WALLPAPER PICKER */ -.wallpaper, .presets { +.wallpaper, #presets { right: 80px; margin-top: 77px; width: 172px; @@ -1440,7 +1440,7 @@ border-left: 1px solid black; transform: translateX(400px); padding: 5px 5px 9px 5px; } -.wallpaper.active, .presets:active { +.wallpaper.active, #presets.active { display:inline-block; -webkit-transform: translateX(0px); transform: translateX(0px); @@ -1629,10 +1629,10 @@ input[type="range"]::-webkit-slider-thumb { .color-swatches { margin-top: 10px; } + .presets { margin-top: 10px; } - .presets span { font-size:12px; font-weight:500; diff --git a/views/controls/editor/presets.ejs b/views/controls/editor/presets.ejs index 2ea4995..a41c527 100644 --- a/views/controls/editor/presets.ejs +++ b/views/controls/editor/presets.ejs @@ -1,4 +1,4 @@ -<div class="vvbox presets"> +<div class="vvbox" id="presets"> <h4>Preset Styles</h4> <div class="presets"> <span data-preset="wireframe"> diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 21bed03..07ee7a5 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -107,6 +107,7 @@ <script type="text/javascript" src="/assets/javascripts/ui/editor/MediaEditor.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/editor/MediaUpload.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/editor/MediaViewer.js"></script> +<script type="text/javascript" src="/assets/javascripts/ui/editor/Presets.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/editor/TextEditor.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/editor/WallpaperPicker.js"></script> |
