|
86 | 86 | import {getDocumentDir} from "./DOM"; |
87 | 87 | // var eventBus = require('./eventBus'); |
88 | 88 |
|
89 | | - var interact = require("interactjs"); |
| 89 | + let interact = require("interactjs"); |
90 | 90 |
|
91 | 91 | export default { |
92 | 92 | name: "GridItem", |
|
224 | 224 | } |
225 | 225 | }, |
226 | 226 | created () { |
227 | | - var self = this; |
| 227 | + let self = this; |
228 | 228 |
|
229 | 229 | // Accessible refernces of functions for removing in beforeDestroy |
230 | 230 | self.updateWidthHandler = function (width) { |
|
271 | 271 | this.rtl = getDocumentDir(); |
272 | 272 | }, |
273 | 273 | beforeDestroy: function(){ |
274 | | - var self = this; |
| 274 | + let self = this; |
275 | 275 | //Remove listeners |
276 | 276 | this.eventBus.$off('updateWidth', self.updateWidthHandler); |
277 | 277 | this.eventBus.$off('compact', self.compactHandler); |
|
363 | 363 | this.createStyle(); |
364 | 364 | }, |
365 | 365 | renderRtl: function () { |
366 | | - console.log("### renderRtl"); |
| 366 | + // console.log("### renderRtl"); |
367 | 367 | this.tryMakeResizable(); |
368 | 368 | this.createStyle(); |
369 | 369 | } |
|
389 | 389 | this.innerX = this.x; |
390 | 390 | this.innerW = this.w; |
391 | 391 | } |
392 | | - var pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
| 392 | + let pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
393 | 393 |
|
394 | 394 |
|
395 | 395 | if (this.isDragging) { |
|
434 | 434 | const {x, y} = position; |
435 | 435 |
|
436 | 436 | const newSize = {width: 0, height: 0}; |
| 437 | + let pos; |
437 | 438 | switch (event.type) { |
438 | 439 | case "resizestart": |
439 | 440 | this.previousW = this.innerW; |
440 | 441 | this.previousH = this.innerH; |
441 | | - var pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
| 442 | + pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
442 | 443 | newSize.width = pos.width; |
443 | 444 | newSize.height = pos.height; |
444 | 445 | this.resizing = newSize; |
|
459 | 460 | break; |
460 | 461 | case "resizeend": |
461 | 462 | //console.log("### resize end => x=" +this.innerX + " y=" + this.innerY + " w=" + this.innerW + " h=" + this.innerH); |
462 | | - var pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
| 463 | + pos = this.calcPosition(this.innerX, this.innerY, this.innerW, this.innerH); |
463 | 464 | newSize.width = pos.width; |
464 | 465 | newSize.height = pos.height; |
465 | 466 | // console.log("### resize end => " + JSON.stringify(newSize)); |
|
469 | 470 | } |
470 | 471 |
|
471 | 472 | // Get new WH |
472 | | - var pos = this.calcWH(newSize.height, newSize.width); |
| 473 | + pos = this.calcWH(newSize.height, newSize.width); |
473 | 474 | if (pos.w < this.minW) { |
474 | 475 | pos.w = this.minW; |
475 | 476 | } |
|
684 | 685 | // console.log("### MIN " + JSON.stringify(minimum)); |
685 | 686 |
|
686 | 687 | const opts = { |
687 | | - preserveAspectRatio: false, |
| 688 | + preserveAspectRatio: true, |
| 689 | + // allowFrom: "." + this.resizableHandleClass, |
688 | 690 | edges: { |
689 | 691 | left: false, |
690 | 692 | right: "." + this.resizableHandleClass, |
|
0 commit comments