0
我正在使用圖像裁剪控件中的dojo.dnd.boxConstrainedMoveable來允許用戶選擇原始圖像的子區域。這個小部件的一部分允許用戶調整圖像大小。發生這種情況時,我重新計算dnd.boxConstrainedMoveable的框約束。Dojo:如何更新dojo.dnd.boxConstrainedMoveable上的約束?
下面是我的代碼,試圖更新constraintBox,但不起作用。是否有另一種方法讓小部件根據新的約束框重新計算其約束條件,因爲它在實例化時計算約束條件?
# var dnd = reference to the boxConstrainedMoveable itself
var mb = dojo.marginBox(cropImage);
var constraintBox = {t: (mb.h - viewportHeight) * -1,
l: (mb.w - viewportWidth) * -1,
w: mb.w,
h: mb.h};
this.dnd.constraintBox = constraintBox; # overwrites, but then is reset to original when moved