From 1544561fda039e32233ef59cdda4fd7ca93dd3ca Mon Sep 17 00:00:00 2001 From: Matthias Bilger Date: Mon, 23 Mar 2020 22:31:21 +0100 Subject: [PATCH] missing flat door fix --- ddimport.js | 15 ++++++++++++--- module.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ddimport.js b/ddimport.js index 8afc8c4..9049424 100644 --- a/ddimport.js +++ b/ddimport.js @@ -175,8 +175,8 @@ class DDImporter { var slopenom = (line[0][1] - line[1][1]) if (slopedenom == 0){ if (point[0] == line[0][0]){ - if ( (point[1] < line[1][1] && point[1] > line[0][1]) || - (point[1] > line[1][1] && point[1] < line[0][1])){ + if ( (point[1] <= line[1][1] && point[1] >= line[0][1]) || + (point[1] >= line[1][1] && point[1] <= line[0][1])){ return true } } @@ -185,7 +185,16 @@ class DDImporter { var slope = slopenom/slopedenom var intercept = line[1][1] - slope * line[1][0] - return (point[1] == (slope * point[0] + intercept)) + let online = (point[1] == (slope * point[0] + intercept)) + if (!online) return false + if (( (point[0] <= line[1][0] && point[0] >= line[0][0]) || + (point[0] >= line[1][0] && point[0] <= line[0][0])) && + ( (point[1] <= line[1][1] && point[1] >= line[0][1]) || + (point[1] >= line[1][1] && point[1] <= line[0][1]))) + { + return true + } + return false } static pointsDistance(point1, point2){ diff --git a/module.json b/module.json index 1fb9fe9..ecf3b4d 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "dd-import", "title": "DungeonDraft Importer", "description": "Imports scene elements from Dungeon Draft map files", - "version": "0.4.21", + "version": "0.4.22", "authors": [ { "name": "Moo Man"