From beb39c5a27d3245dff11eed34ab31663c13d6ac5 Mon Sep 17 00:00:00 2001 From: Julius Krumbiegel <22495855+jkrumbiegel@users.noreply.github.com> Date: Sun, 13 Oct 2024 19:57:28 +0200 Subject: [PATCH 1/4] Add code to fake interaction videos with blocks (#3922) * Add code to fake interaction videos with blocks * hide result * no controls * actually just the word controls cannot be there * add slidergrid * add video to menu * interactive example for intervalslider * add cursor by directly writing sprite to buffer * remove imports again * set px_per_unit to 2 for fake interactions --- assets/cursor.png | Bin 0 -> 1799 bytes assets/cursor_pressed.png | Bin 0 -> 1516 bytes docs/fake_interaction.jl | 254 ++++++++++++++++++++ docs/makedocs.jl | 1 + docs/src/reference/blocks/button.md | 37 ++- docs/src/reference/blocks/intervalslider.md | 62 ++++- docs/src/reference/blocks/menu.md | 45 +++- docs/src/reference/blocks/slidergrid.md | 44 +++- 8 files changed, 437 insertions(+), 6 deletions(-) create mode 100644 assets/cursor.png create mode 100644 assets/cursor_pressed.png create mode 100644 docs/fake_interaction.jl diff --git a/assets/cursor.png b/assets/cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..e630c7c272fa8c12c4abedbba8aedc63d077c8ab GIT binary patch literal 1799 zcmV+i2l)7jP)A4FCWD8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H129!xe zK~z|Uz1V+f6zLtu@%QX*%#S@+?QLwLCTX;>+8Bt$YRQS$XvFjo&iCz1l;ZejC9wHRZoip{K;hUFV)r66M!I) zMLH=3^C&a&1G9!8{jUq@1vv3JaM!L~j?lL4 z^XJe12AB!t0@<$%=@l4}q`bU5?cBLjl4My{>g36jn}HG_>}L0vBRv6AsZ>Ogrc9Y4 zK>PRamn4~{nK*RlP%ZF%H@n9i=@r;5NmHjz6(GYfbmGJbNm4SIjP2gN`&Ynp7nuq8 z-Zbz_Nt!long9Xv`~5n1?wlm)*|TRowY9ZB1B!u3V~O+%{9KX>3kwHi*)zs7^ zNs7f{T`O0vtO1IEiNLtAKzapsNm5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-21(BX&Vu6NE9=0s*Ws%%v)~v1Hna$7L}w@ssBonWm$u;NF?&*g$ozXR#jDf z2+RYfjVW+QBz?SOdT`HW0=XR>9e;L#$p;S}+}ON%^Y4IP;AH$eyr`(NyuRX*lw03i zhTL<8VOT)o>eZ_!%F4=~Zrr%>`n7A<`f--9ejqxe_v4gUFTLN_o8d;`|7wO|JRb%@ pUMyh&AmxG*ZXa-unezDH{{htXXa4{_h++T$002ovPDHLkV1g!3Y=Qs) literal 0 HcmV?d00001 diff --git a/assets/cursor_pressed.png b/assets/cursor_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..b8ea70dbead409d49e93e1064814b77bc486d3ac GIT binary patch literal 1516 zcmVA4FCWD8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H11$jwC zK~z|U#n?|w6jvMv@bBA&Ww+{r{811ILSl$TYr??;2hxZ%8X7TaTEdCg-bf9Nw-QrH zv5hq$Y3RXdshD^`1rNnu*kAyop^cgtiVg?C@<%{$aam@WnVp^a_5f@o>h7?x>o0kS z-8VD)**9_&J5H=x1R!d7uM?pcsE+Is6 zqF}2L5eNX2latQO%*;=FdU}3$xm-Jh5J`!EtwvO!-|q(i6c!d%3=9l31IQ3U*y9ab zji^9f*Ta+a;K75{0|Nt%0JbL#N%Fl7fUT&gsDLD8S?1Exl1b9+>FN0yKso?>r1LkU zMFr;P=NFLV*w`2=Dk`XHnrWJ*ar^e|?*XI%uzg6N$j;8*Lz3g;;{?E(ni?90!B8j^ zx_oFFq!nPUVHn2CmoMJ}0-)V)=dD|}NRspO^Z!*>SC;@t zNi;AtJ3ISMAON~tF825LlO$(nXNSwn%RdI-NF-2y_3G7ofdJ@syZPwRBa-CA#Kb@O z`S}F^k`n?9g+f8E*BcQCfLU2t93CDfNsf$++(}PQ-@Q?!RiO6z_3NlW0L;tF>VJoytqHh`qK0(D(ieLkNhAOIE@7t`zYnk4z)!Gk{l?1(jQTLJD027~It!h&TW z03JGYh_Wo3Bzf=Ny%qqOu^_DimBq!ybpZkJ@ZrPMG|ePwc6WC-VYvcYS4y-5)HH2L zmgRK=0r13$6V!E`p-{-UdGlsH)>&Lw1qPOumSO?|U~O$JP1B^V>%q3Rwy&{{;==-I5E8%cBkd~GPr_%|S%Z1d`RA`z8r_-5SQ&aPsEX(t!PMz`yAr!8R zM5G^&I)bXI`ZY~^XD)WT-QmxrrKPkIfk0rawY7D>l~ELt{(x8>wj4!KhV6FyHiyFz z?sGbwxO(*}Mn^}{(9jV6erRY2#l^+w?(S}rB7l!ph=_0GOGX$@};3lO(66rkIqJ6z;39uO~@9efrb`AO}DSfFuBREHBao z)=}+P0tNyBpJ5mTz@nleK700zBx#zaNs?7nRbgOydO8(FVK5j}j~_q&2@;U%asq*X z&ooVzmX>mEZq6jh=g*)2-PzgsD@k^Bb*-73*REY7N%r;i{Q_WXB7pNG84LzZk{lWu z>P$;Z+p~A?-hGOq_(P!(b8~aUz_PM3lBCz`9a*`}F|SuF0cBbCuG~`N?%li1SkA4< z0JaYf4t9{_nKNhBJl&Eckt8o(y!aJ1P{3LNW(NX+IbGM4j*gD+@Wz52K+1&+7d|J+ z(a}-bY_>4+^y$+iNlB9aS~(}CWq=jncAwAp@1;wZz69XL8wr2qsoXg;Gb54Ykt0XK zz>JIxs;Wv|*Oki3%KeD3+%RwjnR5B^QMZ6Ubo>u+pc@!b SxrU|y0000 nothing, figlike, filepath, events; kwargs...) + +relative_pos(block, rel) = Point2f(block.layoutobservables.computedbbox[].origin .+ rel .* block.layoutobservables.computedbbox[].widths) + +end \ No newline at end of file diff --git a/docs/makedocs.jl b/docs/makedocs.jl index 56b4a61979f..9a600603633 100644 --- a/docs/makedocs.jl +++ b/docs/makedocs.jl @@ -31,6 +31,7 @@ end include("figure_block.jl") include("attrdocs_block.jl") include("shortdocs_block.jl") +include("fake_interaction.jl") docs_url = "docs.makie.org" repo = "github.com/MakieOrg/Makie.jl.git" diff --git a/docs/src/reference/blocks/button.md b/docs/src/reference/blocks/button.md index 5d32181e156..95ef7caae07 100644 --- a/docs/src/reference/blocks/button.md +++ b/docs/src/reference/blocks/button.md @@ -1,6 +1,8 @@ # Button -```@figure backend=GLMakie +```@example button +using GLMakie +GLMakie.activate!() # hide fig = Figure() @@ -24,8 +26,41 @@ barplot!(counts, color = cgrad(:Spectral)[LinRange(0, 1, 5)]) ylims!(ax, 0, 20) fig +nothing # hide ``` +```@setup button +using ..FakeInteraction + +events = [ + Wait(0.5), + Lazy() do fig + MouseTo(relative_pos(buttons[1], (0.3, 0.3))) + end, + LeftClick(), + Wait(0.2), + LeftClick(), + Wait(0.2), + LeftClick(), + Wait(0.4), + Lazy() do fig + MouseTo(relative_pos(buttons[4], (0.7, 0.2))) + end, + Wait(0.2), + LeftClick(), + Wait(0.2), + LeftClick(), + Wait(0.2), + LeftClick(), + Wait(0.5) +] + +interaction_record(fig, "button_example.mp4", events) +``` + +```@raw html +