Add bounds and tags to descriptor

Summary: This is to support a future diff where we will draw a basic wireframe for debugging

Reviewed By: lblasa

Differential Revision: D39509407

fbshipit-source-id: d99fd6fe39404996a0ed944c10905331262fd0c6
This commit is contained in:
Luke De Feo
2022-09-21 07:02:48 -07:00
committed by Facebook GitHub Bot
parent c09e185867
commit 80b05092ac
9 changed files with 81 additions and 2 deletions

View File

@@ -8,7 +8,9 @@
package com.facebook.flipper.plugins.uidebugger.litho
import com.facebook.flipper.plugins.uidebugger.common.InspectableObject
import com.facebook.flipper.plugins.uidebugger.descriptors.BaseTags
import com.facebook.flipper.plugins.uidebugger.descriptors.NodeDescriptor
import com.facebook.flipper.plugins.uidebugger.model.Bounds
import com.facebook.litho.DebugComponent
import com.facebook.litho.LithoView
@@ -29,8 +31,14 @@ object LithoViewDescriptor : NodeDescriptor<LithoView> {
override fun getActiveChild(node: LithoView): Any? = null
override fun getData(node: LithoView) = mapOf<String, InspectableObject>()
override fun getBounds(node: LithoView): Bounds? = null
override fun getTags(node: LithoView): Set<String> = setOf()
}
const val LithoTag = "Litho"
object DebugComponentDescriptor : NodeDescriptor<DebugComponent> {
override fun getId(node: DebugComponent): String = System.identityHashCode(node).toString()
@@ -60,4 +68,10 @@ object DebugComponentDescriptor : NodeDescriptor<DebugComponent> {
override fun getActiveChild(node: DebugComponent): Any? = null
override fun getData(node: DebugComponent) = mapOf<String, InspectableObject>()
override fun getBounds(node: DebugComponent): Bounds {
val bounds = node.bounds
return Bounds(bounds.left, bounds.top, bounds.width(), bounds.height())
}
override fun getTags(node: DebugComponent): Set<String> = setOf(BaseTags.Declarative, LithoTag)
}