Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Correct constraints for draggable if contents is too big
- Loading branch information
Showing
with
9 additions
and
1 deletion.
-
+9
−1
framer/LayerDraggable.coffee
|
@@ -55,7 +55,9 @@ class exports.LayerDraggable extends BaseClass |
|
|
get: -> @_constraints |
|
|
set: (value) -> |
|
|
if value and _.isObject(value) |
|
|
@_constraints = _.defaults(value, {x:0, y:0, width:0, height:0}) |
|
|
value = _.pick(value, ["x", "y", "width", "height"]) |
|
|
value = _.defaults(value, {x:0, y:0, width:0, height:0}) |
|
|
@_constraints = value |
|
|
else |
|
|
@_constraints = {x:0, y:0, width:0, height:0} |
|
|
@_updateSimulationConstraints(@_constraints) if @_constraints |
|
@@ -310,6 +312,12 @@ class exports.LayerDraggable extends BaseClass |
|
|
minY: Infinity |
|
|
maxY: Infinity |
|
|
|
|
|
# Correct the constraints if the layer size exceeds the constraints |
|
|
bounds.width = @layer.width if bounds.width < @layer.width |
|
|
bounds.height = @layer.height if bounds.height < @layer.height |
|
|
|
|
|
#bounds.width = _.max([bounds.width, @layer.width]) |
|
|
|
|
|
constraints = |
|
|
minX: Utils.frameGetMinX(bounds) |
|
|
maxX: Utils.frameGetMaxX(bounds) |
|
|