copying all the width and heights
This commit is contained in:
parent
fa36b9c3c5
commit
3fe5288dd1
|
@ -18,7 +18,7 @@
|
||||||
;; add-fresh-box: world view -> world
|
;; add-fresh-box: world view -> world
|
||||||
;; Given a world, creates a new world within the boundaries of the playground.
|
;; Given a world, creates a new world within the boundaries of the playground.
|
||||||
(define (add-fresh-box w v)
|
(define (add-fresh-box w v)
|
||||||
(define-values (max-width max-height) (width-and-height "playground"))
|
(define-values (max-width max-height) (width-and-height v "playground"))
|
||||||
(define new-world (cons (make-box (fresh-id)
|
(define new-world (cons (make-box (fresh-id)
|
||||||
(random max-width)
|
(random max-width)
|
||||||
(random max-height))
|
(random max-height))
|
||||||
|
@ -29,8 +29,11 @@
|
||||||
|
|
||||||
;; FIXME: do some javascript stuff here to get at this.
|
;; FIXME: do some javascript stuff here to get at this.
|
||||||
;;
|
;;
|
||||||
(define (width-and-height element-id)
|
(define (width-and-height v element-id)
|
||||||
(values 500 500))
|
(define focused (view-focus v element-id))
|
||||||
|
(printf "width is: ~s\n" (view-width focused))
|
||||||
|
(values (view-width focused)
|
||||||
|
(view-height focused)))
|
||||||
|
|
||||||
|
|
||||||
(define (draw w v)
|
(define (draw w v)
|
||||||
|
|
|
@ -75,10 +75,21 @@
|
||||||
var theClone = $(dom).clone(true).get(0);
|
var theClone = $(dom).clone(true).get(0);
|
||||||
var sourceSelects = $(dom).find("select");
|
var sourceSelects = $(dom).find("select");
|
||||||
var destSelects = $(theClone).find("select");
|
var destSelects = $(theClone).find("select");
|
||||||
var i;
|
var i, w;
|
||||||
for (i = 0; i < sourceSelects.length; ++i) {
|
for (i = 0; i < sourceSelects.length; ++i) {
|
||||||
$(destSelects[i]).val($(sourceSelects[i]).val());
|
$(destSelects[i]).val($(sourceSelects[i]).val());
|
||||||
}
|
}
|
||||||
|
var allSrcElts = $(dom).find("*");
|
||||||
|
var allDestElts = $(theClone).find("*");
|
||||||
|
for (i = 0; i < allSrcElts.length; i++) {
|
||||||
|
w = $(allSrcElts[i]).width();
|
||||||
|
if (w) {
|
||||||
|
$(allDestElts[i]).width(w);
|
||||||
|
$(allDestElts[i]).height($(allSrcElts[i]).height());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return theClone;
|
return theClone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user