mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Updated demo, moved "adapt" controller into function
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
visible (value) {
|
||||
if (value) {
|
||||
this.visibility.overlay = true
|
||||
this.adaptSize()
|
||||
|
||||
setTimeout(() => {
|
||||
this.visibility.modal = true
|
||||
@@ -186,11 +187,7 @@
|
||||
onWindowResize () {
|
||||
this.window.width = window.innerWidth
|
||||
this.window.height = window.innerHeight
|
||||
|
||||
if (this.adaptive) {
|
||||
this.modal.width = inRange(0, this.window.width, this.modal.width)
|
||||
this.modal.height = inRange(0, this.window.height, this.modal.height)
|
||||
}
|
||||
this.adaptSize()
|
||||
},
|
||||
|
||||
genEventObject (params) {
|
||||
@@ -202,6 +199,13 @@
|
||||
}, params || {});
|
||||
},
|
||||
|
||||
adaptSize () {
|
||||
if (this.adaptive) {
|
||||
this.modal.width = inRange(0, this.window.width, this.modal.width)
|
||||
this.modal.height = inRange(0, this.window.height, this.modal.height)
|
||||
}
|
||||
},
|
||||
|
||||
resize (event) {
|
||||
this.modal.width = event.size.width
|
||||
this.modal.height = event.size.height
|
||||
@@ -285,7 +289,7 @@
|
||||
},
|
||||
|
||||
removeDraggableListeners () {
|
||||
console.log('removing draggable handlers')
|
||||
// console.log('removing draggable handlers')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
export const inRange = (from, to, value) => {
|
||||
if (value > to) {
|
||||
return to
|
||||
}
|
||||
if (value < from) {
|
||||
return from
|
||||
}
|
||||
|
||||
if (value > to) {
|
||||
return to
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user