|
338 | 338 | this.resizable = this.isResizable; |
339 | 339 | }, |
340 | 340 | resizable: function () { |
341 | | - var self = this; |
342 | | - if (this.interactObj === null || this.interactObj === undefined) { |
343 | | - this.interactObj = interact(this.$refs.item); |
344 | | - } |
345 | | - if (this.resizable) { |
346 | | - var opts = { |
347 | | - preserveAspectRatio: false, |
348 | | - edges: { |
349 | | - left: false, |
350 | | - right: "." + this.resizableHandleClass, |
351 | | - bottom: "." + this.resizableHandleClass, |
352 | | - top: false |
353 | | - }, |
354 | | - ignoreFrom: this.resizeIgnoreFrom |
355 | | - }; |
356 | | -
|
357 | | - this.interactObj.resizable(opts); |
358 | | - if (!this.resizeEventSet) { |
359 | | - this.resizeEventSet = true; |
360 | | - this.interactObj |
361 | | - .on('resizestart resizemove resizeend', function (event) { |
362 | | - self.handleResize(event); |
363 | | - }); |
364 | | - } |
365 | | - } else { |
366 | | - this.interactObj.resizable({ |
367 | | - enabled: false |
368 | | - }); |
369 | | - } |
| 341 | + this.tryMakeResizable(); |
370 | 342 | }, |
371 | 343 | rowHeight: function () { |
372 | 344 | this.createStyle(); |
373 | 345 | }, |
374 | 346 | cols: function () { |
| 347 | + this.tryMakeResizable(); |
375 | 348 | this.createStyle(); |
376 | 349 | }, |
377 | 350 | containerWidth: function () { |
| 351 | + this.tryMakeResizable(); |
378 | 352 | this.createStyle(); |
379 | 353 | }, |
380 | 354 | x: function (newVal) { |
|
698 | 672 | compact: function () { |
699 | 673 | this.createStyle(); |
700 | 674 | }, |
| 675 | + tryMakeResizable: function(){ |
| 676 | + var self = this; |
| 677 | + if (this.interactObj === null || this.interactObj === undefined) { |
| 678 | + this.interactObj = interact(this.$refs.item); |
| 679 | + } |
| 680 | + if (this.resizable) { |
| 681 | + let maximum = this.calcPosition(0,0,this.maxW, this.maxH); |
| 682 | + let minimum = this.calcPosition(0,0, this.minW, this.minH); |
| 683 | +
|
| 684 | + var opts = { |
| 685 | + preserveAspectRatio: false, |
| 686 | + edges: { |
| 687 | + left: false, |
| 688 | + right: "." + this.resizableHandleClass, |
| 689 | + bottom: "." + this.resizableHandleClass, |
| 690 | + top: false |
| 691 | + }, |
| 692 | + ignoreFrom: this.resizeIgnoreFrom, |
| 693 | + restrictSize: { |
| 694 | + min: { |
| 695 | + height: minimum.height, |
| 696 | + width: minimum.width |
| 697 | + }, |
| 698 | + max: { |
| 699 | + height: maximum.height, |
| 700 | + width: maximum.width |
| 701 | + } |
| 702 | + } |
| 703 | + }; |
| 704 | +
|
| 705 | + this.interactObj.resizable(opts); |
| 706 | + if (!this.resizeEventSet) { |
| 707 | + this.resizeEventSet = true; |
| 708 | + this.interactObj |
| 709 | + .on('resizestart resizemove resizeend', function (event) { |
| 710 | + self.handleResize(event); |
| 711 | + }); |
| 712 | + } |
| 713 | + } else { |
| 714 | + this.interactObj.resizable({ |
| 715 | + enabled: false |
| 716 | + }); |
| 717 | + } |
| 718 | + }, |
701 | 719 | autoSize: function() |
702 | 720 | { |
703 | 721 | // ok here we want to calculate if a resize is needed |
|
0 commit comments