Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Paste to current cursor position

$
0
0

@chzh.austin wrote:

I realize the paste behavior adding the copied node on its old location, which means overlapped. For example, https://gojs.net/latest/samples/minimal.html

How can I paste the node to the position where my mouse clicked?

EDIT: I made some progress by overriding pasteSelection method as follow. But this only works for pasting to the same layer. If I paste to other layer, it seems not using the pos I set.

    // paste to current cursor point
    let commandHandler = newDiagram.commandHandler;
    commandHandler.pasteSelection = (pos? : go.Point) => {
        if (!pos) {
            pos = commandHandler.diagram.lastInput.documentPoint;
        }
        go.CommandHandler.prototype.pasteSelection.call(commandHandler, pos);
    }

Thanks,
Chuan

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles