File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
src/main/kotlin/dev/dediamondpro/resourcify Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff 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(
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments