aboutsummaryrefslogtreecommitdiffstats
path: root/root/articles/mmmfs/examples/pinwall
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-02-15 14:38:17 +0000
committers-ol <s-ol@users.noreply.github.com>2020-02-15 14:38:17 +0000
commit3abb5c0be1bba44702a77a32caf368775ab855c2 (patch)
tree5451aae8f5eb499094fd3b6f0338150798f8adf9 /root/articles/mmmfs/examples/pinwall
parentfix conversion want wildcard (diff)
downloadmmm-3abb5c0be1bba44702a77a32caf368775ab855c2.tar.gz
mmm-3abb5c0be1bba44702a77a32caf368775ab855c2.zip
rename articles to research
Diffstat (limited to 'root/articles/mmmfs/examples/pinwall')
-rw-r--r--root/articles/mmmfs/examples/pinwall/$order3
-rw-r--r--root/articles/mmmfs/examples/pinwall/image/image$png.pngbin128929 -> 0 bytes
-rw-r--r--root/articles/mmmfs/examples/pinwall/image/pinwall_info: text$json1
-rw-r--r--root/articles/mmmfs/examples/pinwall/text$moonscript -> fn -> mmm$dom.moon120
-rw-r--r--root/articles/mmmfs/examples/pinwall/text/pinwall_info: text$json1
-rw-r--r--root/articles/mmmfs/examples/pinwall/text/text$plain.txt4
-rw-r--r--root/articles/mmmfs/examples/pinwall/title: text$plain1
-rw-r--r--root/articles/mmmfs/examples/pinwall/video/URL -> video$mp41
-rw-r--r--root/articles/mmmfs/examples/pinwall/video/pinwall_info: text$json1
9 files changed, 0 insertions, 132 deletions
diff --git a/root/articles/mmmfs/examples/pinwall/$order b/root/articles/mmmfs/examples/pinwall/$order
deleted file mode 100644
index b8b054a..0000000
--- a/root/articles/mmmfs/examples/pinwall/$order
+++ /dev/null
@@ -1,3 +0,0 @@
-image
-text
-video
diff --git a/root/articles/mmmfs/examples/pinwall/image/image$png.png b/root/articles/mmmfs/examples/pinwall/image/image$png.png
deleted file mode 100644
index 1628d99..0000000
--- a/root/articles/mmmfs/examples/pinwall/image/image$png.png
+++ /dev/null
Binary files differ
diff --git a/root/articles/mmmfs/examples/pinwall/image/pinwall_info: text$json b/root/articles/mmmfs/examples/pinwall/image/pinwall_info: text$json
deleted file mode 100644
index e5893ac..0000000
--- a/root/articles/mmmfs/examples/pinwall/image/pinwall_info: text$json
+++ /dev/null
@@ -1 +0,0 @@
-{"x": 94.0, "y": 265.0, "w": 205.0, "h": 155.0} \ No newline at end of file
diff --git a/root/articles/mmmfs/examples/pinwall/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/examples/pinwall/text$moonscript -> fn -> mmm$dom.moon
deleted file mode 100644
index e611579..0000000
--- a/root/articles/mmmfs/examples/pinwall/text$moonscript -> fn -> mmm$dom.moon
+++ /dev/null
@@ -1,120 +0,0 @@
-import article, div from require 'mmm.dom'
-import convert from require 'mmm.mmmfs.conversion'
-
-update_info = (fileder, x, y, w, h) ->
- info = (fileder\get 'pinwall_info: table') or x: 100, y: 100, w: 300, h: 300
- info.x = x if x
- info.y = y if y
- info.w = w if w
- info.h = h if h
-
- json = convert 'table', 'text/json', info, fileder, 'pinwall_info'
- fileder\set 'pinwall_info: text/json', json
-
-CLIENT = MODE == 'CLIENT'
-
-=>
-
- pending = {}
- observe = if CLIENT
- map = {}
- observer = js.new js.global.ResizeObserver, (_, entries) ->
- for entry in js.of entries
- if child = map[entry.target]
- rect = entry.contentRect
- pending[child] = -> update_info child, nil, nil, rect.width, rect.height
-
- (node, child) ->
- map[node] = child
- observer\observe node
-
- drag = nil
-
- children = for child in *@children
- info = (child\get 'pinwall_info: table') or x: 100, y: 100, w: 300, h: 300
- wrapper = div {
- style:
- position: 'absolute'
- padding: '10px'
- resize: 'both'
- overflow: 'hidden'
- background: 'var(--gray-dark)'
- border: '1px solid var(--gray-bright)'
-
- left: "#{info.x}px"
- top: "#{info.y}px"
- width: "#{info.w}px"
- height: "#{info.h}px"
-
- -- handle for moving the child
- div {
- style:
- top: '0'
- left: '0'
- right: '0'
- height: '10px'
- cursor: 'pointer'
- position: 'absolute'
-
- onmousedown: CLIENT and (_, e) ->
- node = e.target.parentElement
- drag = {
- :child
- :node
-
- startX: tonumber node.style.left\match '(%d+)px'
- startY: tonumber node.style.top\match '(%d+)px'
- startMouseX: e.clientX
- startMouseY: e.clientY
- }
- }
-
- -- child content
- div {
- style:
- width: '100%'
- height: '100%'
- background: 'var(--white)'
-
- (child\gett 'mmm/dom')
- }
- }
-
- -- listen for resize events
- observe wrapper, child if CLIENT
- wrapper
-
- children.style = {
- width: '1000px'
- height: '500px'
- }
-
- if CLIENT
- children.onmousemove = (_, e) ->
- return unless drag
-
- x = drag.startX + (e.clientX - drag.startMouseX)
- y = drag.startY + (e.clientY - drag.startMouseY)
- drag.node.style.left = "#{x}px"
- drag.node.style.top = "#{y}px"
-
- children.onmouseup = (_, e) ->
- for k, func in pairs pending
- func!
- pending = {}
-
- return unless drag
-
- x = drag.startX + (e.clientX - drag.startMouseX)
- y = drag.startY + (e.clientY - drag.startMouseY)
- update_info drag.child, x, y
- drag = nil
-
- children.onmouseleave = (_, e) ->
- return unless drag
-
- drag.node.style.left = "#{drag.startX}px"
- drag.node.style.top = "#{drag.startY}px"
- drag = nil
-
- article children
diff --git a/root/articles/mmmfs/examples/pinwall/text/pinwall_info: text$json b/root/articles/mmmfs/examples/pinwall/text/pinwall_info: text$json
deleted file mode 100644
index 39bdb45..0000000
--- a/root/articles/mmmfs/examples/pinwall/text/pinwall_info: text$json
+++ /dev/null
@@ -1 +0,0 @@
-{"x": 53.0, "y": 64.0, "w": 396.0, "h": 74.0} \ No newline at end of file
diff --git a/root/articles/mmmfs/examples/pinwall/text/text$plain.txt b/root/articles/mmmfs/examples/pinwall/text/text$plain.txt
deleted file mode 100644
index 8838e5a..0000000
--- a/root/articles/mmmfs/examples/pinwall/text/text$plain.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a pinwall example.
-Every box is a separate fileder.
-The boxes can be rearranged and resized freely.
-If the server is in read-write mode, the changes are saved persistently in real time.
diff --git a/root/articles/mmmfs/examples/pinwall/title: text$plain b/root/articles/mmmfs/examples/pinwall/title: text$plain
deleted file mode 100644
index c629992..0000000
--- a/root/articles/mmmfs/examples/pinwall/title: text$plain
+++ /dev/null
@@ -1 +0,0 @@
-a pinwall
diff --git a/root/articles/mmmfs/examples/pinwall/video/URL -> video$mp4 b/root/articles/mmmfs/examples/pinwall/video/URL -> video$mp4
deleted file mode 100644
index 6364771..0000000
--- a/root/articles/mmmfs/examples/pinwall/video/URL -> video$mp4
+++ /dev/null
@@ -1 +0,0 @@
-https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4
diff --git a/root/articles/mmmfs/examples/pinwall/video/pinwall_info: text$json b/root/articles/mmmfs/examples/pinwall/video/pinwall_info: text$json
deleted file mode 100644
index 7be8702..0000000
--- a/root/articles/mmmfs/examples/pinwall/video/pinwall_info: text$json
+++ /dev/null
@@ -1 +0,0 @@
-{"x": 534.0, "y": 136.0, "w": 387.0, "h": 218.0} \ No newline at end of file