Skip to content

Commit

Permalink
fix negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Saura committed Oct 31, 2024
1 parent 61e1a11 commit 07d4b51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wordcloud2.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ if (!window.clearImmediate) {
clientX = evt.clientX
clientY = evt.clientY
}
var eventX = clientX - rect.left

var eventXvalue = clientX - rect.left
var eventX = eventXvalue < 0 ? 0 : eventXvalue
var eventY = clientY - rect.top

var x = Math.floor(eventX * ((canvas.width / rect.width) || 1) / g)
Expand Down

0 comments on commit 07d4b51

Please sign in to comment.