Less declarations in ui.drag(e)
This commit is contained in:
parent
b3c4dc3d8b
commit
b481304339
@ -232,19 +232,11 @@
|
||||
drag: function(e) {
|
||||
var bottom, left, right, style, top;
|
||||
left = e.clientX - ui.dx;
|
||||
if (left < 10) {
|
||||
left = '0';
|
||||
} else if (ui.width - left < 10) {
|
||||
left = null;
|
||||
}
|
||||
right = left ? null : 0;
|
||||
top = e.clientY - ui.dy;
|
||||
if (top < 10) {
|
||||
top = '0';
|
||||
} else if (ui.height - top < 10) {
|
||||
top = null;
|
||||
}
|
||||
bottom = top ? null : 0;
|
||||
left = left < 10 ? 0 : ui.width - left < 10 ? null : left;
|
||||
top = top < 10 ? 0 : ui.height - top < 10 ? null : top;
|
||||
right = left === null ? 0 : null;
|
||||
bottom = top === null ? 0 : null;
|
||||
style = ui.el.style;
|
||||
style.top = top;
|
||||
style.right = right;
|
||||
|
||||
@ -152,13 +152,17 @@ ui =
|
||||
ui.height = d.body.clientHeight - el.offsetHeight
|
||||
drag: (e) ->
|
||||
left = e.clientX - ui.dx
|
||||
if left < 10 then left = '0'
|
||||
else if ui.width - left < 10 then left = null
|
||||
right = if left then null else 0
|
||||
top = e.clientY - ui.dy
|
||||
if top < 10 then top = '0'
|
||||
else if ui.height - top < 10 then top = null
|
||||
bottom = if top then null else 0
|
||||
left =
|
||||
if left < 10 then 0
|
||||
else if ui.width - left < 10 then null
|
||||
else left
|
||||
top =
|
||||
if top < 10 then 0
|
||||
else if ui.height - top < 10 then null
|
||||
else top
|
||||
right = if left is null then 0 else null
|
||||
bottom = if top is null then 0 else null
|
||||
#using null instead of '' is 4% faster
|
||||
#these 4 statements are 40% faster than 1 style.cssText
|
||||
{style} = ui.el
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user