Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
# Conflicts:
#	examples/simple/dist/index.html
#	examples/simple/dist/simple-cacd81d0010f39b4_bg.wasm
  • Loading branch information
antroids committed Feb 29, 2024
2 parents 2c858a9 + 1c1d8a6 commit 8705a00
Show file tree
Hide file tree
Showing 20 changed files with 1,635 additions and 444 deletions.
135 changes: 135 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ members = [
]

[dependencies]
derivative = "2.2.0"
dyn-clone = "1.0.16"
egui = "0.26.2"
egui_extras = "0.26.2"
itertools = "0.12.1"
num-traits = "0.2.18"
ordered-float = "4.2.0"
strum = { version = "0.26.1", features = ["derive"] }
puffin_egui = "0.26.0"
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ cargo run -p simple
The project is in Proof Of Concept stage. Any public API can be changed in following releases.

### TODO
- [ ] Fix Circles and Rectangles transform
- [x] Fix Circles and Rectangles transform

- [ ] Delete action
- [ ] Modify shape action
- [ ] Modify stroke
- [ ] Fill
- [x] Delete action
- [x] Modify shape action
- [x] Modify stroke
- [x] Fill
- [ ] Add point to path action
- [ ] Selection edit
- [ ] Resize
Expand Down
8 changes: 6 additions & 2 deletions examples/simple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ license = "MIT OR Apache-2.0"

[dependencies]
egui = "0.26.2"
eframe = { version = "0.26.2", features = ["glow", "default_fonts"]}
eframe = { version = "0.26.2", features = ["glow", "default_fonts", "puffin"]}
log = "0.4"
env_logger = "0.11.0"
egui-shape-editor = { path="../.." }

# non web
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin_egui = "0.26.0"

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4"

# Optimize all dependencies even in debug builds:
[profile.dev.package."*"]
opt-level = 2
opt-level = 2
2 changes: 1 addition & 1 deletion examples/simple/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><meta content="text/html; charset=utf-8" http-equiv=Content-Type><meta content="width=device-width,initial-scale=1.0,user-scalable=no" name=viewport><title>Egui Shape Editor Simple Example</title><script type=module>import a,*as b from"/egui-shape-editor/examples/simple/dist/simple-cacd81d0010f39b4.js";a(`/egui-shape-editor/examples/simple/dist/simple-cacd81d0010f39b4_bg.wasm`);window.wasmBindings=b</script><base href=/egui-shape-editor/examples/simple/dist/><link href=/egui-shape-editor/examples/simple/dist/favicon-fa5f8dfd817ed0eb.ico integrity=sha384-51ugb_M6MxWXnuBzfi4hlEvHoydlaHwphMgBiq9SRoMsQJhN39W-8D-J7VEkIYw0 rel=icon><link href=manifest.json rel=manifest><link href=apple-touch-icon.png rel=apple-touch-icon><meta media="(prefers-color-scheme: light)" content=white name=theme-color><meta media="(prefers-color-scheme: dark)" content=#404040 name=theme-color><style>html{touch-action:manipulation}body{background:#909090}@media (prefers-color-scheme:dark){body{background:#404040}}html,body{width:100%;height:100%;overflow:hidden;margin:0!important;padding:0!important}canvas{margin-left:auto;margin-right:auto;display:block;position:absolute;top:0%;left:50%;transform:translate(-50%)}.centered{color:#f0f0f0;text-align:center;margin-left:auto;margin-right:auto;font-family:Ubuntu-Light,Helvetica,sans-serif;font-size:24px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.lds-dual-ring{width:24px;height:24px;display:inline-block}.lds-dual-ring:after{content:" ";border:3px solid #fff;border-color:#fff #0000;border-radius:50%;width:24px;height:24px;margin:0;animation:1.2s linear infinite lds-dual-ring;display:block}@keyframes lds-dual-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}</style><link as=fetch crossorigin href=/egui-shape-editor/examples/simple/dist/simple-cacd81d0010f39b4_bg.wasm integrity=sha384-NxyxC5tgTjLWECy7kyJsjR45kagVBxBpa2vux6s3zS3E73cJsoqRxAC5KSDu9HdV rel=preload type=application/wasm><link crossorigin href=/egui-shape-editor/examples/simple/dist/simple-cacd81d0010f39b4.js integrity=sha384-5A5T6I3QWXEe6-HmdiHZ6vEWloEJfCyStd1ECajTrJ4UdxR1sjiOX5VrucIXRQRa rel=modulepreload></head><body><canvas id=the_canvas_id></canvas><script>if(`serviceWorker` in navigator&&window.location.hash!==`#dev`){window.addEventListener(`load`,(()=>{navigator.serviceWorker.register(`sw.js`)}))}</script></body></html>
<!doctype html><meta content="text/html; charset=utf-8" http-equiv=Content-Type><meta content="width=device-width,initial-scale=1.0,user-scalable=no" name=viewport><title>Egui Shape Editor Simple Example</title><script type=module>import a,*as b from"/egui-shape-editor/examples/simple/dist/simple-71b9eae030171829.js";a(`/egui-shape-editor/examples/simple/dist/simple-71b9eae030171829_bg.wasm`);window.wasmBindings=b</script><base href=/egui-shape-editor/examples/simple/dist/><link href=/egui-shape-editor/examples/simple/dist/favicon-fa5f8dfd817ed0eb.ico integrity=sha384-51ugb_M6MxWXnuBzfi4hlEvHoydlaHwphMgBiq9SRoMsQJhN39W-8D-J7VEkIYw0 rel=icon><link href=manifest.json rel=manifest><link href=apple-touch-icon.png rel=apple-touch-icon><meta media="(prefers-color-scheme: light)" content=white name=theme-color><meta media="(prefers-color-scheme: dark)" content=#404040 name=theme-color><style>html{touch-action:manipulation}body{background:#909090}@media (prefers-color-scheme:dark){body{background:#404040}}html,body{width:100%;height:100%;overflow:hidden;margin:0!important;padding:0!important}canvas{margin-left:auto;margin-right:auto;display:block;position:absolute;top:0%;left:50%;transform:translate(-50%)}.centered{color:#f0f0f0;text-align:center;margin-left:auto;margin-right:auto;font-family:Ubuntu-Light,Helvetica,sans-serif;font-size:24px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.lds-dual-ring{width:24px;height:24px;display:inline-block}.lds-dual-ring:after{content:" ";border:3px solid #fff;border-color:#fff #0000;border-radius:50%;width:24px;height:24px;margin:0;animation:1.2s linear infinite lds-dual-ring;display:block}@keyframes lds-dual-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}</style><link as=fetch crossorigin href=/egui-shape-editor/examples/simple/dist/simple-71b9eae030171829_bg.wasm integrity=sha384-8IEegX-0TYe9KEMZCgZCwLRMog7gN-euMlsNvuqtC_UY3KS6fG9eyqUs7khvyODh rel=preload type=application/wasm><link crossorigin href=/egui-shape-editor/examples/simple/dist/simple-71b9eae030171829.js integrity=sha384-K9EN0U118_19RDJgHV-LWJToVJAz1EIjDqHytqNK35zpuxlrkT7xF15WuEkZMGhb rel=modulepreload></head><body><canvas id=the_canvas_id></canvas><script>if(`serviceWorker` in navigator&&window.location.hash!==`#dev`){window.addEventListener(`load`,(()=>{navigator.serviceWorker.register(`sw.js`)}))}</script><script>`use strict`;(()=>{let g=`0`,f=`div`;const a=`{{__TRUNK_ADDRESS__}}`;let b=``;b=b?b:window.location.protocol===`https:`?`wss`:`ws`;const c=b+ `://`+ a+ `/_trunk/ws`;class d{constructor(){this._overlay=document.createElement(f);const a=this._overlay.style;a.height=`100vh`;a.width=`100vw`;a.position=`fixed`;a.top=g;a.left=g;a.backgroundColor=`rgba(222, 222, 222, 0.5)`;a.fontFamily=`sans-serif`;a.zIndex=`1000000`;a.backdropFilter=`blur(1rem)`;const b=document.createElement(f);b.style.position=`absolute`;b.style.top=`30%`;b.style.left=`15%`;b.style.maxWidth=`85%`;this._title=document.createElement(f);this._title.innerText=`Build failure`;this._title.style.paddingBottom=`2rem`;this._title.style.fontSize=`2.5rem`;this._message=document.createElement(f);this._message.style.whiteSpace=`pre-wrap`;const c=document.createElement(f);c.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#dc3545" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>`;this._title.prepend(c);b.append(this._title,this._message);this._overlay.append(b);this._inject();window.setInterval(()=>{this._inject()},250)}reason(a){this._message.textContent=a}_inject(){if(!this._overlay.isConnected){document.body?.prepend(this._overlay)}}}class e{constructor(a){this.url=a;this.poll_interval=5000;this._overlay=null}start(){const a=new WebSocket(this.url);a.onmessage=a=>{const b=JSON.parse(a.data);switch(b.type){case `reload`:this.reload();break;case `buildFailure`:this.buildFailure(b.data);break}};a.onclose=this.onclose}onclose(){window.setTimeout(()=>{const a=new WebSocket(this.url);a.onopen=()=>window.location.reload();a.onclose=this.onclose},this.poll_interval)}reload(){window.location.reload()}buildFailure({reason:a}){console.error(`Build failed:`,a);console.debug(`Overlay`,this._overlay);if(!this._overlay){this._overlay=new d()};this._overlay.reason=a}}new e(c).start()})()</script></body></html>
Binary file removed examples/simple/dist/simple-cacd81d0010f39b4_bg.wasm
Binary file not shown.
Loading

0 comments on commit 8705a00

Please sign in to comment.