Channel tools box; memberlist/right bar structure refactor
[KiwiIRC.git] / client / src / views / resizehandler.js
1 _kiwi.view.ResizeHandler = Backbone.View.extend({
2 events: {
3 'mousedown': 'startDrag',
4 'mouseup': 'stopDrag'
5 },
6
7 initialize: function () {
8 this.dragging = false;
9 this.starting_width = {};
10
11 $(window).on('mousemove', $.proxy(this.onDrag, this));
12 },
13
14 startDrag: function (event) {
15 this.dragging = true;
16 },
17
18 stopDrag: function (event) {
19 this.dragging = false;
20 },
21
22 onDrag: function (event) {
23 if (!this.dragging) return;
24
25 this.$el.css('left', event.clientX - (this.$el.outerWidth(true) / 2));
26 $('#kiwi .right_bar').css('width', this.$el.parent().width() - (this.$el.position().left + this.$el.outerWidth()));
27 _kiwi.app.view.doLayout();
28 }
29 });