@@ -80,9 +80,10 @@ abstract class AztecDynamicImageSpan(val context: Context, protected var imageDr
8080 if (sizeRect.width() > 0 ) {
8181 return sizeRect.width()
8282 } else {
83- // This code was crucial to get good results for overlapping issue
84- val size = super .getSize(paint, text, start, end, metrics)
85- return size
83+ // This block of code was added in order to resolve
84+ // span overlap issue on Chromebook devices
85+ // -> https://github.com/wordpress-mobile/AztecEditor-Android/pull/835
86+ return super .getSize(paint, text, start, end, metrics)
8687 }
8788 }
8889
@@ -94,9 +95,10 @@ abstract class AztecDynamicImageSpan(val context: Context, protected var imageDr
9495 val layout = textView?.layout
9596
9697 if (measuring || layout == null ) {
97- // if we're in pre-layout phase, just return a tiny rect
98- // It looks like if we return 1 for right and bottom
99- // it will cause overlap
98+ // if we're in pre-layout phase, just return an empty rect
99+ // Update: Previous version of this code was: return Rect(0, 0, 1, 1)
100+ // but we needed to change it as it caused span overlap issue on Chromebook
101+ // devices -> https://github.com/wordpress-mobile/AztecEditor-Android/pull/835
100102 return Rect (0 , 0 , 0 , 0 )
101103 }
102104
@@ -116,14 +118,6 @@ abstract class AztecDynamicImageSpan(val context: Context, protected var imageDr
116118 height = (width / aspectRatio).toInt()
117119 }
118120
119- // Note: This is not a solution just a temp code
120- // to demonstrate that for some reason value 36 ( which is got
121- // from imageDrawable?.intrinsicHeight ) is causing overlap problem
122- // or I think it's causing :D
123- if (height == 36 ) {
124- return Rect (0 , 0 , 0 , 0 )
125- }
126-
127121 imageDrawable?.bounds = Rect (0 , 0 , width, height)
128122
129123 return Rect (imageDrawable?.bounds ? : Rect (0 , 0 , 0 , 0 ))
0 commit comments