Skip to content

Commit

Permalink
Add special handling of link in move handler
Browse files Browse the repository at this point in the history
Modify text decoration and use different cursor
  • Loading branch information
linev committed Oct 1, 2024
1 parent 057b15d commit d728c80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/draw/more.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function drawText() {
}

if (annot !== '3d')
addMoveHandler(this);
addMoveHandler(this, true, is_url);
else {
fp.processRender3D = true;
this.handleRender3D = () => {
Expand Down
8 changes: 6 additions & 2 deletions modules/gui/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function detectRightButton(event) {

/** @summary Add move handlers for drawn element
* @private */
function addMoveHandler(painter, enabled = true) {
function addMoveHandler(painter, enabled = true, hover_handler = false) {
if (!settings.MoveResize || painter.isBatchMode() || !painter.draw_g) return;

if (painter.getPadPainter()?.isEditable() === false)
Expand Down Expand Up @@ -374,9 +374,13 @@ function addMoveHandler(painter, enabled = true) {
}.bind(painter));

painter.draw_g
.style('cursor', 'move')
.style('cursor', hover_handler ? 'pointer' : 'move')
.property('assigned_move', true)
.call(drag_move);

if (hover_handler)
painter.draw_g.on('mouseenter', () => painter.draw_g.style('text-decoration', 'underline'))
.on('mouseleave', () => painter.draw_g.style('text-decoration', null));
}

/** @summary Inject style
Expand Down

0 comments on commit d728c80

Please sign in to comment.