in packages/ketcher-react/src/script/editor/tool/select/select.ts [208:342]
mousemove(event: PointerEvent) {
this.previousMouseMoveEvent = event;
const editor = this.editor;
const rnd = editor.render;
const restruct = editor.render.ctab;
const dragCtx = this.dragCtx;
if (this.isReadyForCopy && !this.isCopied) {
const point = CoordinateTransformation.pageToModel(event, rnd);
const { action, items } = createCopyOfSelected(editor, point);
editor.selection(items);
this.dragCtx.copyAction = action;
this.isCopied = true;
return;
}
if (dragCtx?.stopTapping) dragCtx.stopTapping();
if (dragCtx?.closestItem) {
if (dragCtx.action) {
dragCtx.action.perform(restruct);
}
if (dragCtx.closestItem.map === 'rxnArrows') {
this.dragCtx.action = this.reactionArrowMoveTool.mousemove(
event,
this.dragCtx,
);
} else if (dragCtx.closestItem.map === MULTITAIL_ARROW_KEY) {
this.dragCtx.action = this.multitailArrowMoveTool.mousemove(
event,
this.dragCtx,
);
}
if (dragCtx.action) {
editor.update(dragCtx.action, true);
return true;
}
}
if (dragCtx?.item) {
const atoms = restruct.molecule.atoms;
const selection = editor.selection();
/* handle atoms */
const shouldDisplayDegree =
dragCtx.item.map === 'atoms' &&
atoms?.get(dragCtx.item.id)?.neighbors.length === 1 &&
selection?.atoms?.length === 1 &&
!selection.bonds;
if (shouldDisplayDegree) {
// moving selected objects
const pos = rnd.page2obj(event);
const angle = vectorUtils.calcAngle(dragCtx.xy0, pos);
const degrees = vectorUtils.degrees(angle);
editor.event.message.dispatch({ info: degrees + 'º' });
}
/* end */
/* handle image resize */
if (dragCtx.item.map === IMAGE_KEY && dragCtx.item.ref) {
if (dragCtx.action) dragCtx.action.perform(rnd.ctab);
const position = CoordinateTransformation.pageToModel(event, rnd);
dragCtx.action = fromImageResize(
rnd.ctab,
dragCtx.item.id,
position,
dragCtx.item.ref,
);
editor.update(dragCtx.action, true);
return true;
}
/* end + fullstop */
/* handle simpleObjects */
if (dragCtx.item.map === 'simpleObjects' && dragCtx.item.ref) {
if (dragCtx.action) dragCtx.action.perform(rnd.ctab);
const props = getResizingProps(editor, dragCtx, event);
dragCtx.action = fromSimpleObjectResizing(...props, event.shiftKey);
editor.update(dragCtx.action, true);
return true;
}
/* end + fullstop */
/* handle functionalGroups */
if (dragCtx.item.map === 'functionalGroups' && !dragCtx.action) {
editor.event.showInfo.dispatch(null);
}
/* end */
if (dragCtx.action) {
dragCtx.action.perform(restruct);
}
const expSel = editor.explicitSelected();
dragCtx.action = fromMultipleMove(
restruct,
expSel,
editor.render.page2obj(event).sub(dragCtx.xy0),
);
const visibleSelectedItems = filterNotInContractedSGroup(
expSel,
this.editor.struct(),
);
dragCtx.mergeItems = getItemsToFuse(editor, visibleSelectedItems);
editor.hover(getHoverToFuse(dragCtx.mergeItems));
editor.update(dragCtx.action, true);
return true;
}
const isSelectionRunning = onSelectionMove(
event,
this.editor,
this.#lassoHelper,
);
if (isSelectionRunning) {
return true;
}
const maps = getMapsForClosestItem(
this.#lassoHelper.fragment || event.altKey,
);
const item = editor.findItem(event, maps, null);
editor.hover(item, null, event);
handleMovingPosibilityCursor(
item,
this.editor.render.paper.canvas,
getItemCursor(this.editor.render, item),
);
return true;
}