Skip to content

Strange behavior when resizing #50

Description

@polar-nik

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 😞

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions