Skip to content

Commit

Permalink
Removing mouseMoved because it was not needed, Added mouseDown
Browse files Browse the repository at this point in the history
  • Loading branch information
joshholt authored and etgryphon committed Apr 20, 2011
1 parent 85542ca commit 1f0abd7
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions frameworks/foundation/views/upload.js
Expand Up @@ -96,13 +96,7 @@ SCUI.UploadView = SC.View.extend(
.begin('input')
.attr('type', 'file')
.attr('name', inputName)
.addStyle({ 'position': 'relative',
'height': '100%',
'width': 'auto',
'opacity': '0',
'-moz-opacity': '0',
'filter': 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)' })

.setClass('hidden-upload-input', YES)
.end()
.end()
.end()
Expand Down Expand Up @@ -147,30 +141,9 @@ SCUI.UploadView = SC.View.extend(
sc_super();
},

mouseMoved: function(evt) {
mouseDown: function(evt) {
if (evt.target.nodeName === 'LABEL') {
var ox = 0;
var oy = 0;
var elem = evt.target;

if (elem.offsetParent) {
ox = elem.offsetLeft;
oy = elem.offsetTop;

while (elem = elem.offsetParent) {
ox += elem.offsetLeft;
oy += elem.offsetTop;
}
}

var x = evt.pageX - ox;
var y = evt.pageY - oy;
var w = evt.target.file.offsetWidth;
var h = evt.target.file.offsetHeight;

var input = this.$('input').firstObject();
input.style.top = y - (h / 2) + 'px';
input.style.left = x - (w - 30) + 'px';
this.$('input')[0].click();
}
},

Expand Down

0 comments on commit 1f0abd7

Please sign in to comment.