Voeg 28 herkenbare kleurplaten en creatieve niveaus toe (v0.4.66-beta) #4
3 changed files with 25 additions and 6 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
0.3.73-beta
|
0.3.74-beta
|
||||||
|
|
|
||||||
|
|
@ -566,6 +566,19 @@ function makeMovable(t){
|
||||||
t.addEventListener("pointerdown", e=>{
|
t.addEventListener("pointerdown", e=>{
|
||||||
if(e.target.classList.contains("dtool-x") || e.target.closest(".dtool-opts")) return;
|
if(e.target.classList.contains("dtool-x") || e.target.closest(".dtool-opts")) return;
|
||||||
e.preventDefault(); e.stopPropagation();
|
e.preventDefault(); e.stopPropagation();
|
||||||
|
/* pen actief en neergezet op de randzone van de lat: tekenen gaat vóór
|
||||||
|
verslepen - zoals je een echte liniaal vasthoudt terwijl je erlangs
|
||||||
|
tekent. Alleen een greep verder van de rand verplaatst het gereedschap. */
|
||||||
|
if(!e.target.classList.contains("dtool-rot")
|
||||||
|
&& document.body.classList.contains("pen")
|
||||||
|
&& ["pen","vulp","mark"].includes(PEN.tool)
|
||||||
|
&& (t.classList.contains("dtool-ruler") || t.classList.contains("dtool-geo"))){
|
||||||
|
const r = bInk.getBoundingClientRect();
|
||||||
|
const px = (e.clientX - r.left) * (board.clientWidth / r.width);
|
||||||
|
const py = (e.clientY - r.top) * (board.clientHeight / r.height);
|
||||||
|
const hit = nearestEdge(px, py);
|
||||||
|
if(hit && hit.d <= 24){ startInkStroke(e); return; }
|
||||||
|
}
|
||||||
if(e.target.classList.contains("dtool-rot")){
|
if(e.target.classList.contains("dtool-rot")){
|
||||||
const r = t.getBoundingClientRect();
|
const r = t.getBoundingClientRect();
|
||||||
const cx = r.left+r.width/2, cy = r.top+r.height/2;
|
const cx = r.left+r.width/2, cy = r.top+r.height/2;
|
||||||
|
|
@ -936,9 +949,10 @@ function snapPoint(x, y){
|
||||||
if(Math.hypot(px-qx, py-qy) > 60){ bSnap = null; return [x, y]; }
|
if(Math.hypot(px-qx, py-qy) > 60){ bSnap = null; return [x, y]; }
|
||||||
return [qx*k, qy*k];
|
return [qx*k, qy*k];
|
||||||
}
|
}
|
||||||
bInk.addEventListener("pointerdown", e=>{
|
/* start van een haal; ook aanroepbaar vanaf de liniaal/geodriehoek zelf
|
||||||
if(e.pointerType==="mouse" && e.button!==0) return;
|
(pen op de randzone van de lat = tekenen, niet verslepen) - de pointer
|
||||||
e.preventDefault();
|
capture op bInk stuurt de vervolg-events vanzelf hierheen */
|
||||||
|
function startInkStroke(e){
|
||||||
if(PEN.tool==="text"){ startBoardText(e); return; }
|
if(PEN.tool==="text"){ startBoardText(e); return; }
|
||||||
bInk.setPointerCapture(e.pointerId);
|
bInk.setPointerCapture(e.pointerId);
|
||||||
bDraw = true;
|
bDraw = true;
|
||||||
|
|
@ -948,11 +962,16 @@ bInk.addEventListener("pointerdown", e=>{
|
||||||
if(PEN.tool!=="erase" && PEN.tool!=="hand"){
|
if(PEN.tool!=="erase" && PEN.tool!=="hand"){
|
||||||
const k = bInk.width / board.clientWidth;
|
const k = bInk.width / board.clientWidth;
|
||||||
const hit = nearestEdge(bx/k, by/k);
|
const hit = nearestEdge(bx/k, by/k);
|
||||||
if(hit && hit.d <= 16) bSnap = hit;
|
if(hit && hit.d <= 24) bSnap = hit;
|
||||||
}
|
}
|
||||||
[bx,by] = snapPoint(bx, by);
|
[bx,by] = snapPoint(bx, by);
|
||||||
bMidX = bMidY = null;
|
bMidX = bMidY = null;
|
||||||
bStroke(bx+0.01, by+0.01, e.pressure, e.pointerType);
|
bStroke(bx+0.01, by+0.01, e.pressure, e.pointerType);
|
||||||
|
}
|
||||||
|
bInk.addEventListener("pointerdown", e=>{
|
||||||
|
if(e.pointerType==="mouse" && e.button!==0) return;
|
||||||
|
e.preventDefault();
|
||||||
|
startInkStroke(e);
|
||||||
});
|
});
|
||||||
bInk.addEventListener("pointermove", e=>{
|
bInk.addEventListener("pointermove", e=>{
|
||||||
if(!bDraw) return;
|
if(!bDraw) return;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
/* version — shown until /api/version resolves (or if the fetch fails, e.g. offline).
|
/* version — shown until /api/version resolves (or if the fetch fails, e.g. offline).
|
||||||
Kept in sync by hand with the VERSION file at the repo root on every release. */
|
Kept in sync by hand with the VERSION file at the repo root on every release. */
|
||||||
const VERSION = "0.3.73-beta";
|
const VERSION = "0.3.74-beta";
|
||||||
(function(){
|
(function(){
|
||||||
const tag = document.getElementById("verTag");
|
const tag = document.getElementById("verTag");
|
||||||
tag.textContent = "v"+VERSION;
|
tag.textContent = "v"+VERSION;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue