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;
|
this.window.height = window.innerHeight;
|
||||||
|
|
||||||
if (this.adaptive) {
|
if (this.adaptive) {
|
||||||
var width = this.window.width > this.width
|
var width = this.window.width > this.modal.width
|
||||||
? this.width
|
? this.modal.width
|
||||||
: this.window.width
|
: this.window.width
|
||||||
|
|
||||||
/*this.modal.height*/
|
var height = this.window.height > this.modal.height
|
||||||
var height = this.window.height > this.height
|
? this.modal.height
|
||||||
? this.height
|
|
||||||
: this.window.height;
|
: this.window.height;
|
||||||
|
|
||||||
this.modal.width = width;//Math.max(width, this.minWidth);
|
this.modal.width = width;//Math.max(width, this.minWidth);
|
||||||
@@ -167,6 +166,7 @@
|
|||||||
},
|
},
|
||||||
resize(event) {
|
resize(event) {
|
||||||
this.modal.width = event.size.width;
|
this.modal.width = event.size.width;
|
||||||
|
this.modal.height = event.size.height;
|
||||||
|
|
||||||
let resizeEvent = this.genEventObject({
|
let resizeEvent = this.genEventObject({
|
||||||
size: this.modal
|
size: this.modal
|
||||||
|
|||||||
@@ -24,11 +24,14 @@ export default {
|
|||||||
this.$el.addEventListener('mousedown', this.start, false);
|
this.$el.addEventListener('mousedown', this.start, false);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
start() {
|
start(event) {
|
||||||
this.clicked = true;
|
this.clicked = true;
|
||||||
|
|
||||||
window.addEventListener('mousemove', this.mousemove, false);
|
window.addEventListener('mousemove', this.mousemove, false);
|
||||||
window.addEventListener('mouseup', this.stop, false);
|
window.addEventListener('mouseup', this.stop, false);
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
@@ -51,12 +54,21 @@ export default {
|
|||||||
var width = event.clientX - el.offsetLeft;
|
var width = event.clientX - el.offsetLeft;
|
||||||
var height = event.clientY - el.offsetTop;
|
var height = event.clientY - el.offsetTop;
|
||||||
|
|
||||||
|
|
||||||
|
if (width < this.minWidth) {
|
||||||
|
width = this.minWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width > window.innerWidth) {
|
||||||
|
width = window.innerWidth;
|
||||||
|
}
|
||||||
|
|
||||||
if (height < this.minHeight) {
|
if (height < this.minHeight) {
|
||||||
height = this.minHeight;
|
height = this.minHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width < this.minWidth) {
|
if (height > window.innerHeight) {
|
||||||
width = this.minWidth;
|
height = window.innerHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.size = {width, height};
|
this.size = {width, height};
|
||||||
|
|||||||
Reference in New Issue
Block a user