Graflow: autofit removed translations
This commit is contained in:
+1
-10
@@ -1196,11 +1196,6 @@ class BZgraflow extends Buildoz{
|
|||||||
|
|
||||||
autofit(percent=100){
|
autofit(percent=100){
|
||||||
if(!this.parentElement) return
|
if(!this.parentElement) return
|
||||||
|
|
||||||
const prevTransformOrigin = this.style.transformOrigin
|
|
||||||
this.style.transform = 'none'
|
|
||||||
this.style.transformOrigin = 'top left'
|
|
||||||
|
|
||||||
// Measure real content by unioning viewport-space bounding boxes.
|
// Measure real content by unioning viewport-space bounding boxes.
|
||||||
// This is robust with overflow:auto and absolute-positioned layers.
|
// This is robust with overflow:auto and absolute-positioned layers.
|
||||||
let left = Infinity
|
let left = Infinity
|
||||||
@@ -1229,11 +1224,7 @@ class BZgraflow extends Buildoz{
|
|||||||
const sx = parentBB.width / contentW
|
const sx = parentBB.width / contentW
|
||||||
const sy = parentBB.height / contentH
|
const sy = parentBB.height / contentH
|
||||||
const scale = Math.min(sx, sy)*(percent/100) // uniform scale to fit inside parent
|
const scale = Math.min(sx, sy)*(percent/100) // uniform scale to fit inside parent
|
||||||
const tx = Number.isFinite(left) ? (-left + gapx) : gapx
|
this.style.transform = `scale(${scale})`
|
||||||
const ty = Number.isFinite(top) ? (-top + gapy) : gapy
|
|
||||||
this.style.transformOrigin = prevTransformOrigin || 'top left'
|
|
||||||
// First normalize content origin to (0,0), then scale to fit.
|
|
||||||
this.style.transform = `scale(${scale}) translate(${tx}px, ${ty}px)`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Buildoz.define('graflow', BZgraflow)
|
Buildoz.define('graflow', BZgraflow)
|
||||||
|
|||||||
Reference in New Issue
Block a user