From c61cbabca7bf45237fbfcece42d4caa6834cb42f Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Fri, 18 Sep 2020 13:30:57 +0200 Subject: [PATCH] Update --- src/data.js | 2 +- src/display.js | 1 + src/index.js | 3 +++ style.css | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/data.js b/src/data.js index 970eee7..30f8626 100644 --- a/src/data.js +++ b/src/data.js @@ -67,7 +67,7 @@ export const items = [ }, { icon: 'UnskilledLabour2.svg', - linkable: ['Gefährdete Gesundheit'], + linkable: ['Gefährdete Gesundheit', 'Überarbeitet', 'Arm'], img: 'hans.png', name: 'Hans', desc: '12, Kinderarbeiter', diff --git a/src/display.js b/src/display.js index 6e586bd..5f8fe2f 100644 --- a/src/display.js +++ b/src/display.js @@ -19,6 +19,7 @@ export class Display { target.addEventListener('dragstart', e => { let target = findA(e.target) if (!target || !target.draggable) return + e.dataTransfer.clearData() e.dataTransfer.setData('application/prs.x', target.dataset['id']) e.dataTransfer.effectAllowed = 'link' }) diff --git a/src/index.js b/src/index.js index dec093d..b0eb009 100644 --- a/src/index.js +++ b/src/index.js @@ -24,6 +24,9 @@ class Actions { state.show = null } link(from, to) { + if (from == to) return false + const ok = state.items[from].linkable.filter(i => state.items[to].linkable.includes(i)).length > 0 + if (!ok) return false state.links.push({id: state.links.length, from, to}) return true } diff --git a/style.css b/style.css index 955484b..bd000b3 100644 --- a/style.css +++ b/style.css @@ -62,7 +62,7 @@ body { text-align: center; position: absolute; transform-origin: 0 0; - font-size: 1.2em; + font-size: 1.4em; padding: 0 70px; box-sizing: border-box; }