smarter knob sizing & compute widgets' sizes as soon as possible to avoid resize blinking
-> we do that by triggering the global resize event handler when loading a tab / editing a widget
This commit is contained in:
parent
b7bdaef70f
commit
f5d848321c
12 changed files with 49 additions and 39 deletions
File diff suppressed because one or more lines are too long
|
|
@ -92,6 +92,7 @@ var updateDom = function(container,data) {
|
|||
|
||||
newContainer.find('[data-tab]:first-child').click()
|
||||
|
||||
$(window).resize()
|
||||
|
||||
purgeStores(purgetabs)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,24 @@ module.exports = function(session,callback) {
|
|||
|
||||
setTimeout(function(){
|
||||
parsetabs(session,$('#container'),true)
|
||||
|
||||
// var t = $('<div></div>').appendTo('body')
|
||||
// for (id in TABS) {
|
||||
// if (id!='#container') {
|
||||
// t[0].appendChild(TABS[id].tab[0])
|
||||
// }
|
||||
// }
|
||||
// setTimeout(function(){
|
||||
// t.detach()
|
||||
// },250)
|
||||
|
||||
|
||||
ui.init()
|
||||
editorDisable()
|
||||
editorInit()
|
||||
sync()
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
spinner.remove()
|
||||
if (!callback) return
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ var tabs = function() {
|
|||
if (!$(this).siblings('.on').length) $(this).click()
|
||||
})
|
||||
|
||||
$(window).resize()
|
||||
|
||||
})
|
||||
$('li[data-tab]').first().click()
|
||||
|
|
|
|||
|
|
@ -98,8 +98,10 @@ module.exports.create = function(widgetData,container) {
|
|||
mask.size = 0
|
||||
widget.value = undefined
|
||||
|
||||
wrapper.resize(function(){
|
||||
var w = Math.floor(wrapper[0].offsetWidth*.58)
|
||||
wrapper.resize(function(e,width,height){
|
||||
|
||||
var w = Math.floor(Math.min(height,width)*.58)
|
||||
|
||||
if (!w || mask.size==w) return
|
||||
mask.size=w
|
||||
mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
if (!self.visible) {
|
||||
widget.visible = true
|
||||
canvas.addClass('visible')
|
||||
widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
if (!self.visible) {
|
||||
widget.visible = true
|
||||
canvas.addClass('visible')
|
||||
widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,6 +505,7 @@ var updateDom = function(container,data) {
|
|||
|
||||
newContainer.find('[data-tab]:first-child').click()
|
||||
|
||||
$(window).resize()
|
||||
|
||||
purgeStores(purgetabs)
|
||||
|
||||
|
|
@ -1164,10 +1165,24 @@ module.exports = function(session,callback) {
|
|||
|
||||
setTimeout(function(){
|
||||
parsetabs(session,$('#container'),true)
|
||||
|
||||
// var t = $('<div></div>').appendTo('body')
|
||||
// for (id in TABS) {
|
||||
// if (id!='#container') {
|
||||
// t[0].appendChild(TABS[id].tab[0])
|
||||
// }
|
||||
// }
|
||||
// setTimeout(function(){
|
||||
// t.detach()
|
||||
// },250)
|
||||
|
||||
|
||||
ui.init()
|
||||
editorDisable()
|
||||
editorInit()
|
||||
sync()
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
spinner.remove()
|
||||
if (!callback) return
|
||||
|
|
@ -1537,6 +1552,7 @@ var tabs = function() {
|
|||
if (!$(this).siblings('.on').length) $(this).click()
|
||||
})
|
||||
|
||||
$(window).resize()
|
||||
|
||||
})
|
||||
$('li[data-tab]').first().click()
|
||||
|
|
@ -2106,8 +2122,10 @@ module.exports.create = function(widgetData,container) {
|
|||
mask.size = 0
|
||||
widget.value = undefined
|
||||
|
||||
wrapper.resize(function(){
|
||||
var w = Math.floor(wrapper[0].offsetWidth*.58)
|
||||
wrapper.resize(function(e,width,height){
|
||||
|
||||
var w = Math.floor(Math.min(height,width)*.58)
|
||||
|
||||
if (!w || mask.size==w) return
|
||||
mask.size=w
|
||||
mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`)
|
||||
|
|
@ -2785,7 +2803,6 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
if (!self.visible) {
|
||||
widget.visible = true
|
||||
canvas.addClass('visible')
|
||||
widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent')
|
||||
}
|
||||
|
||||
|
|
@ -3722,7 +3739,6 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
if (!self.visible) {
|
||||
widget.visible = true
|
||||
canvas.addClass('visible')
|
||||
widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent')
|
||||
}
|
||||
|
||||
|
|
@ -4421,24 +4437,17 @@ var startEvent = 'ontouchstart' in window ?'touchstart':'mousedown'
|
|||
self.width = undefined
|
||||
self.color = undefined
|
||||
self.center = settings.align == 'center'
|
||||
self.visible = false
|
||||
|
||||
|
||||
self.attr('tabindex',"0")
|
||||
|
||||
canvas.resize(function(e){
|
||||
canvas.resize(function(e,width,height){
|
||||
e.stopPropagation()
|
||||
|
||||
var width = canvas.width()*2,
|
||||
height = canvas.height()*2
|
||||
var width = width*2,
|
||||
height = height*2
|
||||
|
||||
if (height==100 && width==100) return
|
||||
|
||||
if (!self.visible) {
|
||||
self.visible = true
|
||||
canvas.addClass('visible')
|
||||
}
|
||||
|
||||
self.color = getComputedStyle(document.documentElement).getPropertyValue("--color-text")
|
||||
self.height=height
|
||||
self.width=width
|
||||
|
|
|
|||
|
|
@ -15,24 +15,17 @@ var startEvent = 'ontouchstart' in window ?'touchstart':'mousedown'
|
|||
self.width = undefined
|
||||
self.color = undefined
|
||||
self.center = settings.align == 'center'
|
||||
self.visible = false
|
||||
|
||||
|
||||
self.attr('tabindex',"0")
|
||||
|
||||
canvas.resize(function(e){
|
||||
canvas.resize(function(e,width,height){
|
||||
e.stopPropagation()
|
||||
|
||||
var width = canvas.width()*2,
|
||||
height = canvas.height()*2
|
||||
var width = width*2,
|
||||
height = height*2
|
||||
|
||||
if (height==100 && width==100) return
|
||||
|
||||
if (!self.visible) {
|
||||
self.visible = true
|
||||
canvas.addClass('visible')
|
||||
}
|
||||
|
||||
self.color = getComputedStyle(document.documentElement).getPropertyValue("--color-text")
|
||||
self.height=height
|
||||
self.width=width
|
||||
|
|
|
|||
|
|
@ -72,11 +72,7 @@
|
|||
canvas {
|
||||
width:100%;
|
||||
height:100%;
|
||||
opacity: 0;
|
||||
transition: opacity .2s;
|
||||
&.visible {
|
||||
opacity:.8;
|
||||
}
|
||||
opacity: 0.8;
|
||||
}
|
||||
input + canvas {
|
||||
visibility: hidden;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
--color-knob: var(--color-custom);
|
||||
|
||||
width: 100rem;
|
||||
height: 150rem;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,11 +54,6 @@
|
|||
top:0;left:0;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: opacity .2s;
|
||||
&.visible {
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue