Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复createLine因pointList为空而报错的问题。 #60

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/base_easy_marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '10'; // @fix 40 -> 10。理论上要比HighlightLine和Cursor等元素要低的吧
children[i].style.position = 'relative'
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/element/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down