Fix not being able to open Redstone Emitter GUI
This commit is contained in:
parent
219033476c
commit
89e91796a5
|
@ -84,7 +84,7 @@ class Label(
|
||||||
if (RenderHelper.disabled) return false
|
if (RenderHelper.disabled) return false
|
||||||
|
|
||||||
val oldSize = intrinsicContentSize
|
val oldSize = intrinsicContentSize
|
||||||
if (wrappingMode == WrappingMode.WRAP && canWrap) {
|
if (wrappingMode == WrappingMode.WRAP && canWrap && hasSolver) {
|
||||||
val lines = textRenderer.wrapLines(text, bounds.width.toInt())
|
val lines = textRenderer.wrapLines(text, bounds.width.toInt())
|
||||||
val height = (if (maxLines == 0) lines.size else min(lines.size, maxLines)) * textRenderer.fontHeight
|
val height = (if (maxLines == 0) lines.size else min(lines.size, maxLines)) * textRenderer.fontHeight
|
||||||
intrinsicContentSize = Size(bounds.width, height.toDouble())
|
intrinsicContentSize = Size(bounds.width, height.toDouble())
|
||||||
|
|
|
@ -48,6 +48,9 @@ open class View(): Responder {
|
||||||
*/
|
*/
|
||||||
var solver: Solver by solverDelegate
|
var solver: Solver by solverDelegate
|
||||||
|
|
||||||
|
val hasSolver: Boolean
|
||||||
|
get() = solverDelegate.isInitialized
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout anchor for the left edge of this view in the window's coordinate system.
|
* Layout anchor for the left edge of this view in the window's coordinate system.
|
||||||
*/
|
*/
|
||||||
|
@ -92,17 +95,22 @@ open class View(): Responder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The rectangle for this view in the coordinate system of its superview view (or the window, if there is no superview).
|
* The rectangle for this view in the coordinate system of its superview view (or the window, if there is no superview).
|
||||||
* If using constraint based layout, this property is not initialized until [didLayout] called.
|
* If using constraint based layout, this property has zero dimensions until [didLayout] called.
|
||||||
* Otherwise, this must be set manually.
|
* Otherwise, this must be set manually.
|
||||||
* Setting this property updates the [bounds].
|
* Setting this property updates the [bounds].
|
||||||
*/
|
*/
|
||||||
var frame: Rect by ObservableLateInitProperty { this.bounds = Rect(Point.ORIGIN, it.size) }
|
var frame = Rect(0.0, 0.0, 0.0, 0.0)
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
bounds = Rect(Point.ORIGIN, value.size)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The rectangle for this view in its own coordinate system.
|
* The rectangle for this view in its own coordinate system.
|
||||||
* If using constraint based layout, this property is not initialized until [didLayout] called.
|
* If using constraint based layout, this property has zero dimensions until [didLayout] called.
|
||||||
* Otherwise, this will be initialized when [frame] is set.
|
* Otherwise, this will be initialized when [frame] is set.
|
||||||
*/
|
*/
|
||||||
lateinit var bounds: Rect
|
var bounds = Rect(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position on the Z-axis of this view.
|
* The position on the Z-axis of this view.
|
||||||
|
@ -182,7 +190,7 @@ open class View(): Responder {
|
||||||
subviewsSortedByZIndex = subviews.sortedBy(View::zIndex)
|
subviewsSortedByZIndex = subviews.sortedBy(View::zIndex)
|
||||||
|
|
||||||
view.superview = this
|
view.superview = this
|
||||||
if (solverDelegate.isInitialized) {
|
if (hasSolver) {
|
||||||
view.solver = solver
|
view.solver = solver
|
||||||
}
|
}
|
||||||
view.window = window
|
view.window = window
|
||||||
|
@ -293,7 +301,7 @@ open class View(): Responder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateIntrinsicContentSizeConstraints(old: Size?, new: Size?) {
|
private fun updateIntrinsicContentSizeConstraints(old: Size?, new: Size?) {
|
||||||
if (!usesConstraintBasedLayout || !solverDelegate.isInitialized) return
|
if (!usesConstraintBasedLayout || !hasSolver) return
|
||||||
|
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
solver.removeConstraint(intrinsicContentSizeWidthConstraint!!)
|
solver.removeConstraint(intrinsicContentSizeWidthConstraint!!)
|
||||||
|
|
Loading…
Reference in New Issue