need to optimize soon
This commit is contained in:
parent
c29ec1bf7e
commit
202436383d
|
@ -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)))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user