need to optimize soon

This commit is contained in:
Danny Yoo 2012-06-24 20:29:06 -04:00
parent c29ec1bf7e
commit 202436383d
2 changed files with 14 additions and 4 deletions

View File

@ -78,17 +78,25 @@
[else
w]))
(define (mousemove w v evt)
(cond
[(shape? (world-dragged w))
(define-values (left top) (normalize-mouse-event-coordinates v evt))
(make-world (world-shapes w)
(make-shape (shape-id (world-dragged w))
(event-ref evt "pageX")
(event-ref evt "pageY")))]
left
top))]
[else
w]))
(define (normalize-mouse-event-coordinates v evt)
(values (- (event-ref evt "pageX")
(string->number (trim-px (view-css v "left"))))
(- (event-ref evt "pageY")
(string->number (trim-px (view-css v "top"))))))
(define (trim-px s)
(substring s 0 (- (string-length s) 2)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -75,7 +75,7 @@
var theClone = $(dom).clone(true).get(0);
var sourceSelects = $(dom).find("select");
var destSelects = $(theClone).find("select");
var i, w;
var i, w, o;
for (i = 0; i < sourceSelects.length; ++i) {
$(destSelects[i]).val($(sourceSelects[i]).val());
}
@ -87,6 +87,8 @@
$(allDestElts[i]).width(w);
$(allDestElts[i]).height($(allSrcElts[i]).height());
}
$(allDestElts[i]).offset($(allSrcElts[i]).offset());
}