mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Added resizing borders
This commit is contained in:
@@ -143,13 +143,12 @@
|
||||
this.window.height = window.innerHeight;
|
||||
|
||||
if (this.adaptive) {
|
||||
var width = this.window.width > this.width
|
||||
? this.width
|
||||
var width = this.window.width > this.modal.width
|
||||
? this.modal.width
|
||||
: this.window.width
|
||||
|
||||
/*this.modal.height*/
|
||||
var height = this.window.height > this.height
|
||||
? this.height
|
||||
var height = this.window.height > this.modal.height
|
||||
? this.modal.height
|
||||
: this.window.height;
|
||||
|
||||
this.modal.width = width;//Math.max(width, this.minWidth);
|
||||
@@ -167,6 +166,7 @@
|
||||
},
|
||||
resize(event) {
|
||||
this.modal.width = event.size.width;
|
||||
this.modal.height = event.size.height;
|
||||
|
||||
let resizeEvent = this.genEventObject({
|
||||
size: this.modal
|
||||
|
||||
@@ -24,11 +24,14 @@ export default {
|
||||
this.$el.addEventListener('mousedown', this.start, false);
|
||||
},
|
||||
methods: {
|
||||
start() {
|
||||
start(event) {
|
||||
this.clicked = true;
|
||||
|
||||
window.addEventListener('mousemove', this.mousemove, false);
|
||||
window.addEventListener('mouseup', this.stop, false);
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
},
|
||||
stop() {
|
||||
this.clicked = false;
|
||||
@@ -51,12 +54,21 @@ export default {
|
||||
var width = event.clientX - el.offsetLeft;
|
||||
var height = event.clientY - el.offsetTop;
|
||||
|
||||
|
||||
if (width < this.minWidth) {
|
||||
width = this.minWidth;
|
||||
}
|
||||
|
||||
if (width > window.innerWidth) {
|
||||
width = window.innerWidth;
|
||||
}
|
||||
|
||||
if (height < this.minHeight) {
|
||||
height = this.minHeight;
|
||||
}
|
||||
|
||||
if (width < this.minWidth) {
|
||||
width = this.minWidth;
|
||||
if (height > window.innerHeight) {
|
||||
height = window.innerHeight;
|
||||
}
|
||||
|
||||
this.size = {width, height};
|
||||
|
||||
Reference in New Issue
Block a user