Skip to content

SC.FlowedLayout breaks DropTarget #497

Closed
iammerrick opened this Issue Jun 3, 2011 · 6 comments

3 participants

@iammerrick

The SC.FlowedLayout clippingFrame()

305   /** @private */
306   clippingFrame: function() {
307     return { left: 0, top: 0, width: this.get('calculatedWidth'), height: this.get('calculatedHeight') };
308   }.property('calculatedWidth', 'calculatedHeight'),

Breaks dropTarget as when it returns {0, 0, 0, 0} (is empty) the drop events never get fired properly. However inspecting the element shows it has a proper width, and adding to your view object, the view implementing SC.FlowedLayout with:

clippingFrame: function() {
    return sc_super();
}.property('calculatedWidth', 'calculatedHeight'),

Solves the problem, not sure what the ultimate fix for SC.FlowedLayout should be but I wanted to bring this up as an issue that requires a workaround.

@ialexi
ialexi commented Jun 3, 2011

Interesting... makes sense, I guess. Not sure what FlowedLayout's clippingframe should actually be. Nor when/why clippingFrame was overridden.

Are there any side effects from your change when running Test Controls or running the flowed layout unit tests?

(Flowed Layout tests somewhere near http://localhost:4020/sproutcore/foundation/en/current/tests.html )

@iammerrick

ialexi I imagine they changed it so if the contents request a wider ranger it could be flexible to growth. Not sure though. Also I made a manual hack my own Mixin:


var ViewFlowedLayout = SC.extend(SC.FlowedLayout, {
  clippingFrame: function() {
    return sc_super();
  }.property('calculatedWidth', 'calculatedHeight')
});

If you like I could pull and modify and run it through the tests.

@ialexi
ialexi commented Jun 3, 2011
@iammerrick

That sounds like it would be much much less break prone.

@iammerrick

Turns out my hack does not work if it is a fresh instantiation of objects, in fact it blows up and crashes the browser. I hope we can find a viable fix to this.

@publickeating
SproutCore member

Closed for stale and because SC.FlowedLayout is getting phased out in favor of child view layout plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.