Skip to content

Commit ccd547e

Browse files
committed
East resizing
Needs cleanup, however working concept.
1 parent f82ead5 commit ccd547e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

webdows/explorer.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var explorer = {
4848
return this.is.fullScreen;
4949
}, drag : function(target, handle, callback) {
5050
var mouseDown = false;
51+
var first = true;
5152
var offsetX, offsetY, lastX, lastY, touchKey, touchStartE;
5253
if(typeof handle == 'undefined') {
5354
handle = null;
@@ -90,6 +91,7 @@ var explorer = {
9091
}
9192
mouseDownEvent.on('touchend', function(e) {
9293
mouseDown = false;
94+
first = true;
9395
});
9496
$('#desktop.explorer').on('mousemove touchmove', function(e) {
9597
if(mouseDown) {
@@ -115,6 +117,7 @@ var explorer = {
115117
callback.call({
116118
target: target,
117119
handle: handle,
120+
first: first,
118121
event: e,
119122
x: {
120123
parentOffset: parentOffsetX,
@@ -125,14 +128,17 @@ var explorer = {
125128
movement: movementY
126129
}
127130
});
131+
first = false;
128132
}
129133
}
130134
}).on('mouseup', function(e) {
131135
if(e.which == 0 || e.which == 1) {
132136
mouseDown = false;
137+
first = true;
133138
}
134139
});
135140
}, resize : function(target, handles = ['n','e','s','w','ne','se','sw','nw']) {
141+
target = $(target);
136142
$.each(handles, function() {
137143
var handle = $('<div class="resize '+this+'"></div>');
138144
var callback = function() {};
@@ -141,7 +147,14 @@ var explorer = {
141147

142148
};
143149
} else if(this == 'e') {
150+
var initialWidth = 0;
144151
callback = function() {
152+
if(this.first) {
153+
initialWidth = Number.parseInt(target.css('width'));
154+
}
155+
initialWidth += this.x.movement;
156+
target.css('width', initialWidth);
157+
145158
console.log(this);
146159
};
147160
} else if(this == 's') {
@@ -171,7 +184,7 @@ var explorer = {
171184
} else {
172185
return true;
173186
}
174-
handle.appendTo($(target));
187+
handle.appendTo(target);
175188
explorer.drag(target, handle, callback);
176189
})
177190
}, initiate : function() {

0 commit comments

Comments
 (0)