From 8978761743e5c4fb1820f199aac348b335b860dc Mon Sep 17 00:00:00 2001 From: cyc <472427714@qq.com> Date: Wed, 3 Mar 2021 14:50:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8DcreateLine=E5=9B=A0pointL?= =?UTF-8?q?ist=E4=B8=BA=E7=A9=BA=E8=80=8C=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iPhone 6s IOS9的points有可能为空,因为rect.width === 0。 --- package.json | 2 +- src/element/highlight.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 98a03e5..c226784 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easy-marker", - "version": "1.1.23", + "version": "1.1.24", "description": "Easy marker", "main": "dist/easy-marker.esm.js", "scripts": { diff --git a/src/element/highlight.js b/src/element/highlight.js index 021d6fc..8889cef 100644 --- a/src/element/highlight.js +++ b/src/element/highlight.js @@ -244,11 +244,13 @@ export default class Highlight extends BaseElement { } createLine(pointList) { + const line = document.createElementNS('http://www.w3.org/2000/svg', 'line') + if (!pointList[2] || !pointList[3]) return line; + const x1 = pointList[2][0] const y1 = pointList[2][1] + 1 const x2 = pointList[3][0] const y2 = pointList[3][1] + 1 - const line = document.createElementNS('http://www.w3.org/2000/svg', 'line') line.style.stroke = this.option.underlineColor line.style.strokeWidth = this.option.underlineWidth line.setAttribute('x1', x1) From d6d74fa35819dc1c8dbf5e664bb871b51cbff586 Mon Sep 17 00:00:00 2001 From: cyc <472427714@qq.com> Date: Mon, 6 Jun 2022 17:58:22 +0800 Subject: [PATCH 2/3] bugfix --- src/base_easy_marker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base_easy_marker.js b/src/base_easy_marker.js index 384f0c7..61006ac 100644 --- a/src/base_easy_marker.js +++ b/src/base_easy_marker.js @@ -589,7 +589,7 @@ class EasyMarker { if (this.options.adjustTextStyleDisabled) return const { children } = this.container for (let i = 0; i < children.length; i++) { - children[i].style.zIndex = '40' + children[i].style.zIndex = '20'; // @fix 40 -> 20。理论上要比HighlightLine和Cursor等元素要低的吧 children[i].style.position = 'relative' } } From d02088d650bae6fe5803999ba140b9fe4a7d96a6 Mon Sep 17 00:00:00 2001 From: cyc <472427714@qq.com> Date: Mon, 6 Jun 2022 18:10:05 +0800 Subject: [PATCH 3/3] Update base_easy_marker.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [fix] EasyMarker元素被富文本背景色挡住的问题 --- src/base_easy_marker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base_easy_marker.js b/src/base_easy_marker.js index 61006ac..9fcd195 100644 --- a/src/base_easy_marker.js +++ b/src/base_easy_marker.js @@ -589,7 +589,7 @@ class EasyMarker { if (this.options.adjustTextStyleDisabled) return const { children } = this.container for (let i = 0; i < children.length; i++) { - children[i].style.zIndex = '20'; // @fix 40 -> 20。理论上要比HighlightLine和Cursor等元素要低的吧 + children[i].style.zIndex = '10'; // @fix 40 -> 10。理论上要比HighlightLine和Cursor等元素要低的吧 children[i].style.position = 'relative' } }