Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior when resizing #50

Open
polar-nik opened this issue May 29, 2017 · 0 comments
Open

Strange behavior when resizing #50

polar-nik opened this issue May 29, 2017 · 0 comments

Comments

@polar-nik
Copy link

Hi again!
Very often after changing the block size it is stretched to a huge size.
Here's my code:

<div class="design-parent" ng-class="variable.opt.allowResize"  ng-controller="HelpController as Helper"
     dnd-draggable      = "true"
     dnd-draggable-opts = "{ layer: 'design-area' }"
     dnd-on-dragend     = "Main.dragEnd(variable)"

     dnd-resizable    = "true"
     dnd-on-resizeend = "Main.resizeEnd(variable)"

     dnd-rect  = "variable.env"
     dnd-model = "variable">
    <div class="design-children">
        <design-control></design-control>
        <div ng-include="Tpl.getObject(variable)"></div>
    </div>
</div>

Main.resizeEnd is:

self.resizeEnd = function (object, isGrid) {
    if(showLogs) { console.group('resizeEnd'); }

    isGrid = isGrid ? isGrid : false;

    var coords = getRoundedNumbers(object.env.width, object.env.height),
        minWidth, minHeight, maxWidth, maxHeight;


    if (isGrid) {
        minWidth  = 380;
        minHeight = 140;
        maxWidth  = 2600;
        maxHeight = 1400;
    } else {
        minWidth  = 180;
        minHeight = 40;
        maxWidth  = 600;
        maxHeight = 400;
    }

    // Here we limit the maximum size
    if (coords[0] < minWidth)  { coords[0] = minWidth;  debugIt(coords[0], '@resize.end.min-width'); console.log('wr1'); }
    if (coords[1] < minHeight) { coords[1] = minHeight; debugIt(coords[1], '@resize.end.min-height'); console.log('wr2'); }

    if (coords[0] > maxWidth)  { coords[0] = maxWidth;  debugIt(coords[0], '@resize.end.max-width'); console.log('wr3'); }
    if (coords[1] > maxHeight) { coords[1] = maxHeight; debugIt(coords[1], '@resize.end.max-height'); console.log('wr4'); }


    object.env.width  = coords[0];
    object.env.height = coords[1];
}

I do not understand why 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant