Compare commits

...

4 Commits

Author SHA1 Message Date
Folkert Kevelam
fb27b4c46a Fill out set based graphing 2025-08-28 20:19:18 +02:00
Folkert Kevelam
955bfe3487 Add scroll behaviour 2025-08-28 20:18:42 +02:00
Folkert Kevelam
04820b6fe1 Fix command location and name: 2025-08-28 20:18:18 +02:00
Folkert Kevelam
cd04fd0c8b Initial commit 2025-08-28 20:17:48 +02:00
7 changed files with 43 additions and 7 deletions

View File

@ -316,6 +316,11 @@ class PushPull(WebSocketHandler):
for socket in websockets:
socket.write_message({"course" : content})
@classmethod
def update_scroll(cls, content):
for socket in websockets:
socket.write_message({"scroll" : content[0]/float(content[1])})
def open(self):
if self not in websockets:
websockets.append(self)
@ -392,5 +397,6 @@ async def main(base_path):
Publisher.subscribe("PushPull", "title", PushPull.update_title)
Publisher.subscribe("PushPull", "course", PushPull.update_course)
Publisher.subscribe("PushPull", "date", PushPull.update_date)
Publisher.subscribe("PushPull", "scroll", PushPull.update_scroll)
application.listen(8888)
await asyncio.Event().wait()

View File

@ -1,3 +1,5 @@
type Set
predicate SubSet(Set s1, Set s2)
predicate Disjoint(Set s1, Set s2)
predicate Union(Set s1, Set s2)

View File

@ -1,17 +1,37 @@
canvas {
width = 100
height = 100
width = 500
height = 500
}
forall Set A; Set B
where SubSet(A, B) {
ensure disjoint(B.text, A.icon, 10.0)
ensure contains(A.icon, B.icon, 5.0)
A.icon above B.icon
layer A.icon above B.icon
}
forall Set A; Set B
where Disjoint(A, B) {
ensure disjoint(A.icon, B.icon)
}
forall Set A; Set B
where Union(A,B) {
ensure overlapping(A.icon, B.icon)
ensure disjoint(A.text, B.icon)
ensure disjoint(B.text, A.icon)
}
forall Set x {
x.icon = Circle {
shape x.icon = Circle {
strokeWidth : 0.0
}
ensure x.icon.r > 25
shape x.text = Equation {
string : x.label
fontSize : "32px"
}
ensure contains(x.icon, x.text)
encourage norm(x.text.center - x.icon.center) == 0
layer x.text above x.icon
ensure x.icon.r > 25.0
}

1
install.sh Executable file
View File

@ -0,0 +1 @@
~/.local/bin/pex ./Server/ -o MarkdownPreviewer.pex -e MarkdownPreviewer:launcher -r ./Server/requirements.txt

View File

@ -80,7 +80,7 @@ function module.setup()
local base_location = cwd:gsub("lua/MarkdownPreviewer", "")
o.cmd = {
base_location .. "Server/test.pex",
base_location .. "MarkdownPreviewer.pex",
"--base",
base_location
}

View File

@ -43,7 +43,7 @@ function module.open()
group = augroup,
buffer = bufnr,
callback = function()
server_connection:scroll(vim.fn.line('.'))
server_connection:scroll({vim.fn.line('.'), vim.fn.line('$')})
end,
})

View File

@ -77,6 +77,13 @@
Object.entries(data).forEach(([k,v]) => {
console.log(k,v);
switch (k) {
case "scroll":
var height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
window.scrollTo({left : 0, top: height * v, behavior: 'smooth'});
break;
case "show":
change_body(v)
break;