Skip to content

Commit 430b21f

Browse files
authored
Merge branch 'master' into master
2 parents d3b52cf + e426f6b commit 430b21f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/GridItem.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,45 @@
715715
enabled: false
716716
});
717717
}
718+
},
719+
autoSize: function()
720+
{
721+
// ok here we want to calculate if a resize is needed
722+
this.previousW = this.innerW;
723+
this.previousH = this.innerH;
724+
725+
let newSize=this.$slots.default[0].elm.getBoundingClientRect();
726+
let pos = this.calcWH(newSize.height, newSize.width);
727+
if (pos.w < this.minW) {
728+
pos.w = this.minW;
729+
}
730+
if (pos.w > this.maxW) {
731+
pos.w = this.maxW;
732+
}
733+
if (pos.h < this.minH) {
734+
pos.h = this.minH;
735+
}
736+
if (pos.h > this.maxH) {
737+
pos.h = this.maxH;
738+
}
739+
740+
if (pos.h < 1) {
741+
pos.h = 1;
742+
}
743+
if (pos.w < 1) {
744+
pos.w = 1;
745+
}
746+
747+
// this.lastW = x; // basicly, this is copied from resizehandler, but shouldn't be needed
748+
// this.lastH = y;
749+
750+
if (this.innerW !== pos.w || this.innerH !== pos.h) {
751+
this.$emit("resize", this.i, pos.h, pos.w, newSize.height, newSize.width);
752+
}
753+
if (this.previousW !== pos.w || this.previousH !== pos.h) {
754+
this.$emit("resized", this.i, pos.h, pos.w, newSize.height, newSize.width);
755+
this.eventBus.$emit("resizeEvent", "resizeend", this.i, this.innerX, this.innerY, pos.h, pos.w);
756+
}
718757
}
719758
},
720759
}

0 commit comments

Comments
 (0)