mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
LLM-11514: AI Promo Window
(cherry picked from commit 697963592532aba7e6bd23d2fb0c7175e75085b0) Review: IJ-CR-147924 GitOrigin-RevId: d23245bc5999332f117658240e89ed04e988c48f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1eb095a5c
commit
155624f4f5
@@ -47,6 +47,22 @@ object DarculaNewUIUtil {
|
||||
}
|
||||
}
|
||||
|
||||
fun paintComponentBorder(g: Graphics, rect: Rectangle, color: Color, arc: Float, thick: Int) {
|
||||
val g2 = g.create() as Graphics2D
|
||||
|
||||
try {
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
if (MacUIUtil.USE_QUARTZ) RenderingHints.VALUE_STROKE_PURE else RenderingHints.VALUE_STROKE_NORMALIZE)
|
||||
|
||||
g2.color = color
|
||||
paintRectangle(g2, rect, arc, thick)
|
||||
}
|
||||
finally {
|
||||
g2.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills part of component inside border
|
||||
*/
|
||||
|
||||
@@ -71,6 +71,54 @@ object WebAnimationUtils {
|
||||
return createSingleContentHtmlPage(body, background, componentId)
|
||||
}
|
||||
|
||||
fun createVideoHtmlPageWithUrl(
|
||||
videoUrl: String,
|
||||
background: Color,
|
||||
stubImageUrl: String? = null,
|
||||
autoplay: Boolean = true,
|
||||
loop: Boolean = true,
|
||||
injectedVideoEndedListener: String? = null,
|
||||
): String {
|
||||
val componentId = "video"
|
||||
val scriptText =
|
||||
"""
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let video = document.getElementById("$componentId");
|
||||
|
||||
window.playVideo = function() {
|
||||
video.play();
|
||||
}
|
||||
|
||||
window.pauseVideo = function() {
|
||||
video.pause();
|
||||
}
|
||||
|
||||
window.resetVideo = function() {
|
||||
video.currentTime = 0;
|
||||
}
|
||||
${if (injectedVideoEndedListener != null) """video.addEventListener('ended', function() { $injectedVideoEndedListener });""" else ""}
|
||||
});
|
||||
""".trimIndent()
|
||||
|
||||
val script = HtmlChunk.tag("script").addRaw(scriptText)
|
||||
|
||||
val videoTag = HtmlChunk.tag("video")
|
||||
.attr("id", componentId)
|
||||
.let { if (autoplay) it.attr("autoplay") else it }
|
||||
.let { if (loop) it.attr("loop") else it }
|
||||
.attr("muted")
|
||||
.let { if (stubImageUrl != null) it.attr("poster", stubImageUrl) else it }
|
||||
.child(HtmlChunk.tag("source")
|
||||
.attr("type", "video/webm")
|
||||
.attr("src", videoUrl)
|
||||
)
|
||||
val body = HtmlChunk.body()
|
||||
.child(script)
|
||||
.child(videoTag)
|
||||
|
||||
return createSingleContentHtmlPage(body, background, componentId)
|
||||
}
|
||||
|
||||
private fun createSingleContentHtmlPage(body: HtmlChunk, background: Color, componentId: String): String {
|
||||
val head = HtmlChunk.head().child(getSingleContentCssStyles(background, componentId))
|
||||
return HtmlChunk.html()
|
||||
|
||||
Reference in New Issue
Block a user