aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-10-26 17:24:43 -0400
committerbobzel <zzzman@gmail.com>2021-10-26 17:24:43 -0400
commit92f34533d58291036ff6123c38502cbd4e22300d (patch)
tree3ea20f1fe213b994c6465be103f783fc0212a539 /src/Utils.ts
parent2155d39fbc4a9bac3945e40ee10f95f41df466d3 (diff)
parent48d5e650ddc8caa8252561bbc91961f2f4677d6e (diff)
Merge branch 'master' into ink_v1
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 7ec4f69f3..bfb29fe8d 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -575,7 +575,7 @@ export function simulateMouseClick(element: Element | null | undefined, x: numbe
export function DashColor(color: string) {
try {
- return Color(color.toLowerCase());
+ return color ? Color(color.toLowerCase()) : Color("transparent");
} catch (e) {
console.log("COLOR error:", e);
return Color("red");
@@ -599,7 +599,7 @@ export function getWordAtPoint(elem: any, x: number, y: number): string | undefi
range.selectNodeContents(elem);
var currentPos = 0;
const endPos = range.endOffset;
- while (currentPos + 1 < endPos) {
+ while (currentPos + 1 <= endPos) {
range.setStart(elem, currentPos);
range.setEnd(elem, currentPos + 1);
const rangeRect = range.getBoundingClientRect();