Customized Drag preview in Palette

In my palette I have 3 shapes :

  • The main icon
  • White container
  • Label

I want to

  • Disable the drag action when the user start dragging from the white container. It’s only allowed on the Label and the Main Icon.
  • Display in the preview only the Main Icon without the Label.

I wonder if this is the best approach to achieve the last point (in the link below)
But how to disable the drag for some Parts though ?

EDIT: Just used caStart in the DraggingTool with findObjectsAt(this.diagram.lastInput) to solve the first point

You can set pickable: false on your white shape. But the space will still be pickable, since you have a red background on the entire Node. You will have to remove that background also, and make the TextBlock’s background red some other way. Something like:

    go.TextBlock,
    {
      background: "red",
      stretch: go.GraphObject.Vertical,
      verticalAlignment: go.Spot.Center
    },

Would be equivalent.

Display in the preview only the Main Icon without the Label.

By “in the preview” you mean when dragging? How you are doing it is probably OK, but you should use opacity instead so that the object does not need to re-measure:

    new go.Binding("opacity", "isDragged", (isDragged) => {
      return isDragged ? 0 : 1;
    })