Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
is linkingTool connected to draggingTool in go.js?

I am trying to add functionality to a go.js diagram such that, you can only create links when the shift key is pressed. I can do that fine. But as a consequence, I don't want the user to be able to move the node when the shift key is pressed.

To achieve part 1, I overrode linkingTool.canStart. This achieved that goal admerably.

To achieve part 2, I overrode draggingTool.canStart. This stops the ability to drag nodes but breaks part 1 with an Uncaught TypeError: this.findLinkablePort is not a function.

tool = myDiagram.toolManager.linkingTool
  tool.canStart = function(){
    return event.shiftKey && go.LinkingTool.prototype.canStart.call(tool)
  }

tool = myDiagram.toolManager.draggingTool
  tool.canStart = function(){
    return !event.shiftKey && go.DraggingTool.prototype.canStart.call(tool)
  }

My assumption is that linkingTool uses draggingTool somehow, but I cant find that in the API and I don't know what I can do to fix it. Any ideas as to what is going on?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can't depend on event in event.shiftKey. Instead use this.diagram.lastInput.shift.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!