Move the edit menu logic to uiInit

Make context the first argument of operation objects
Add Paste operation to edit menu when opening the context menu on a blank area of the map (close #2508)
This commit is contained in:
Quincy Morgan
2020-05-14 15:49:35 -04:00
parent c939924f83
commit db9eed2434
32 changed files with 256 additions and 148 deletions
+4 -4
View File
@@ -6,7 +6,7 @@ import { geoExtent, geoPointInPolygon, geoVecSubtract } from '../geo';
import { modeMove } from '../modes/move';
import { uiCmd } from '../ui/cmd';
// see also `operationPaste`
export function behaviorPaste(context) {
function doPaste() {
@@ -22,13 +22,13 @@ export function behaviorPaste(context) {
if (!geoPointInPolygon(mouse, viewport)) return;
var extent = geoExtent();
var oldIDs = context.copyIDs();
if (!oldIDs.length) return;
var extent = geoExtent();
var oldGraph = context.copyGraph();
var newIDs = [];
if (!oldIDs.length) return;
var action = actionCopyEntities(oldIDs, oldGraph);
context.perform(action);