Skip to content

Commit 5a3f6b8

Browse files
committed
fix small issues
1 parent 91f6324 commit 5a3f6b8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/kotlin/dev/dediamondpro/resourcify/elements/markdown/ResourcifyMarkdownImageElement.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ResourcifyMarkdownImageElement(
5050
) {
5151
if (uiImage == null) {
5252
uiImage = UIImage(CompletableFuture.supplyAsync { image }, EmptyImage)
53-
uiImage?.textureMinFilter = UIImage.TextureScalingMode.LINEAR_MIPMAP_LINEAR
53+
uiImage?.textureMinFilter = UIImage.TextureScalingMode.LINEAR
5454
uiImage?.textureMagFilter = UIImage.TextureScalingMode.LINEAR
5555
}
5656
uiImage?.drawImage(

src/main/kotlin/dev/dediamondpro/resourcify/gui/browsepage/BrowseScreen.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class BrowseScreen(
5959
private val selectedCategories = mutableListOf<String>()
6060
private var fetchingFuture: CompletableFuture<ISearchData?>? = null
6161
private var totalHits: Int = 0
62-
private var guiOpenedTime = UMinecraft.getTime()
62+
private var adLoadedTime: Long = -1
6363

6464
private val contentBox = UIContainer().constrain {
6565
x = CenterConstraint()
@@ -275,14 +275,18 @@ class BrowseScreen(
275275
if (ad == null) return@whenComplete
276276

277277
Window.enqueueRenderOperation {
278+
adLoadedTime = UMinecraft.getTime()
279+
278280
adBox.constrain {
279281
x = 0.pixels()
280282
y = 0.pixels()
281283
width = 100.percent()
282284
height = 29.pixels()
283285
}.onMouseClick {
284-
// Prevents opening the ad link accidentally right when the GUI is opened
285-
if (it.mouseButton != 0 || guiOpenedTime + 500 > UMinecraft.getTime()) return@onMouseClick
286+
// Prevents opening the ad link accidentally right after it is loaded when things like search bar shift
287+
if (it.mouseButton != 0 || adLoadedTime == -1L || adLoadedTime + 500 > UMinecraft.getTime()) {
288+
return@onMouseClick
289+
}
286290
UDesktop.browse(ad.getUrl().toURI())
287291
}
288292
headerBox.constrain {

0 commit comments

Comments
 (0)