Run function before drag from palette

Howdy.

I’m working with a palette and a custom HTMLInfo tooltip. The HTML Tooltip Div is obscuring parts of my main Diagram and preventing users from dropping nodes there.

I want to call the function that hides my tooltip div just before a drag event from the palette occurs.
Is there a more simple way of doing this or do I have to learn how do some sort of “customDraggingTool” where I extend the current dragging tool… where the only change is the addition of one function call at the beginning?

Under normal circumstances, a drag from another diagram will not cause tooltips to appear in the target diagram. So that problem cannot arise.

There must be something you are doing to cause that to happen, though. See what’s calling your HTMLInfo.show function.

Sorry - I wasn’t clear enough in my initial post. Here’s a picture to help me explain:

The tooltip IS for the node in the Palette. Hover over the “C” node in the Palette, get a tooltip. It’s displaying when & how I want.

I am using an HTMLInfo-style Tooltip, because I wanted the Tooltip to be able to overflow the bounds of the Palette Diagram. What I didn’t count on, though, was that the Tooltip doesn’t go away when I’m trying to drag a node from the Palette to the main Diagram.

During the drag operation, the Tooltip Div remains visible in front of my Diagrams. Obscuring node placement for that (admittedly small) area.

I can instruct users to intentionally NOT attempt to drop the node where the tooltip is still displayed. If you drop anywhere on the diagram other than the Tooltip Div everything works fine. I’m just trying to avoid having this small UI quibble that people will get irritated about.

In short - I want the Palette tooltip to go away when dragging its nodes.

Ah, I see. I assume the tooltip does go away after 5 seconds (or whatever time you have set for it).

You will need to override the DraggingTool.doActivate method of the Palette. Something like:

$(go.Palette, . . .,
  { . . .,
    "draggingTool.doActivate": function() {
        this.diagram.toolManager.hideToolTip();
        go.DraggingTool.prototype.doActivate.call(this);
    }
  })

Oh wow I copy/pasted that and it worked immediately.

Thanks Walter. You’re the man.

Also to confirm your assumption - yeah the tooltip was going away if I waited 5 seconds.