fix images with focal point not shown in timeline (#1256)
This commit is contained in:
parent
47104bf2cf
commit
419ae80c60
1 changed files with 7 additions and 4 deletions
|
@ -88,7 +88,6 @@ defStyleAttr: Int = 0
|
||||||
* Overridden setScaleType method which only accepts the new type if we don't have a focal
|
* Overridden setScaleType method which only accepts the new type if we don't have a focal
|
||||||
* point set.
|
* point set.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
override fun setScaleType(type: ScaleType) {
|
override fun setScaleType(type: ScaleType) {
|
||||||
if (focus != null) {
|
if (focus != null) {
|
||||||
|
@ -103,7 +102,7 @@ defStyleAttr: Int = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||||
onSizeChanged(width, height, width, height)
|
recalculateMatrix(width, height, resource)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +112,12 @@ defStyleAttr: Int = 0
|
||||||
* matrix if we have a set focal point. It then reassigns the matrix to this imageView.
|
* matrix if we have a set focal point. It then reassigns the matrix to this imageView.
|
||||||
*/
|
*/
|
||||||
override fun onSizeChanged(width: Int, height: Int, oldWidth: Int, oldHeight: Int) {
|
override fun onSizeChanged(width: Int, height: Int, oldWidth: Int, oldHeight: Int) {
|
||||||
|
recalculateMatrix(width, height, drawable)
|
||||||
|
|
||||||
|
super.onSizeChanged(width, height, oldWidth, oldHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun recalculateMatrix(width: Int, height: Int, drawable: Drawable?) {
|
||||||
if (drawable != null && focus != null && focalMatrix != null) {
|
if (drawable != null && focus != null && focalMatrix != null) {
|
||||||
scaleType = ScaleType.MATRIX
|
scaleType = ScaleType.MATRIX
|
||||||
FocalPointUtil.updateFocalPointMatrix(width.toFloat(), height.toFloat(),
|
FocalPointUtil.updateFocalPointMatrix(width.toFloat(), height.toFloat(),
|
||||||
|
@ -120,7 +125,5 @@ defStyleAttr: Int = 0
|
||||||
focus as Attachment.Focus, focalMatrix as Matrix)
|
focus as Attachment.Focus, focalMatrix as Matrix)
|
||||||
imageMatrix = focalMatrix
|
imageMatrix = focalMatrix
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onSizeChanged(width, height, oldWidth, oldHeight)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue