Compare commits
4 Commits
b3470dce7b
...
fb27b4c46a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb27b4c46a | ||
|
|
955bfe3487 | ||
|
|
04820b6fe1 | ||
|
|
cd04fd0c8b |
|
|
@ -316,6 +316,11 @@ class PushPull(WebSocketHandler):
|
||||||
for socket in websockets:
|
for socket in websockets:
|
||||||
socket.write_message({"course" : content})
|
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):
|
def open(self):
|
||||||
if self not in websockets:
|
if self not in websockets:
|
||||||
websockets.append(self)
|
websockets.append(self)
|
||||||
|
|
@ -392,5 +397,6 @@ async def main(base_path):
|
||||||
Publisher.subscribe("PushPull", "title", PushPull.update_title)
|
Publisher.subscribe("PushPull", "title", PushPull.update_title)
|
||||||
Publisher.subscribe("PushPull", "course", PushPull.update_course)
|
Publisher.subscribe("PushPull", "course", PushPull.update_course)
|
||||||
Publisher.subscribe("PushPull", "date", PushPull.update_date)
|
Publisher.subscribe("PushPull", "date", PushPull.update_date)
|
||||||
|
Publisher.subscribe("PushPull", "scroll", PushPull.update_scroll)
|
||||||
application.listen(8888)
|
application.listen(8888)
|
||||||
await asyncio.Event().wait()
|
await asyncio.Event().wait()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
type Set
|
type Set
|
||||||
|
|
||||||
predicate SubSet(Set s1, Set s2)
|
predicate SubSet(Set s1, Set s2)
|
||||||
|
predicate Disjoint(Set s1, Set s2)
|
||||||
|
predicate Union(Set s1, Set s2)
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,37 @@
|
||||||
canvas {
|
canvas {
|
||||||
width = 100
|
width = 500
|
||||||
height = 100
|
height = 500
|
||||||
}
|
}
|
||||||
|
|
||||||
forall Set A; Set B
|
forall Set A; Set B
|
||||||
where SubSet(A, B) {
|
where SubSet(A, B) {
|
||||||
|
ensure disjoint(B.text, A.icon, 10.0)
|
||||||
ensure contains(A.icon, B.icon, 5.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 {
|
forall Set x {
|
||||||
x.icon = Circle {
|
shape x.icon = Circle {
|
||||||
strokeWidth : 0.0
|
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
1
install.sh
Executable file
|
|
@ -0,0 +1 @@
|
||||||
|
~/.local/bin/pex ./Server/ -o MarkdownPreviewer.pex -e MarkdownPreviewer:launcher -r ./Server/requirements.txt
|
||||||
|
|
@ -80,7 +80,7 @@ function module.setup()
|
||||||
local base_location = cwd:gsub("lua/MarkdownPreviewer", "")
|
local base_location = cwd:gsub("lua/MarkdownPreviewer", "")
|
||||||
|
|
||||||
o.cmd = {
|
o.cmd = {
|
||||||
base_location .. "Server/test.pex",
|
base_location .. "MarkdownPreviewer.pex",
|
||||||
"--base",
|
"--base",
|
||||||
base_location
|
base_location
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ function module.open()
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
server_connection:scroll(vim.fn.line('.'))
|
server_connection:scroll({vim.fn.line('.'), vim.fn.line('$')})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,13 @@
|
||||||
Object.entries(data).forEach(([k,v]) => {
|
Object.entries(data).forEach(([k,v]) => {
|
||||||
console.log(k,v);
|
console.log(k,v);
|
||||||
switch (k) {
|
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":
|
case "show":
|
||||||
change_body(v)
|
change_body(v)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user