Skip to content

Commit

Permalink
Feat: box select - detection 2 (debug)
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Feb 12, 2019
1 parent ef3805b commit be44edc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion x-pack/plugins/canvas/public/lib/aeroelastic/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ const alignmentGuideAnnotations = select(getAlignmentGuideAnnotations)(

const hoverAnnotations = select(getHoverAnnotations)(
configuration,
hoveredShape,
select((h, b) =>
h
.slice(0, 1)
.concat(b)
.filter((d, i, a) => a.indexOf(d) === i)
)(hoveredShapes, boxSelected),
selectedPrimaryShapeIds,
draggedShape
);
Expand Down
19 changes: 10 additions & 9 deletions x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,6 @@ export const getSelectionState = (
boxSelected,
allShapes
) => {
// console.log(boxSelected.map(s => s.id).join(', '));
const uidUnchanged = uid === prev.uid;
const mouseButtonUp = !down;
const updateFromDirectSelect =
Expand Down Expand Up @@ -1308,14 +1307,16 @@ export const getAdHocChildrenAnnotations = (config, { shapes }) => {
.map(borderAnnotation(config.getAdHocChildAnnotationName, config.hoverLift));
};

export const getHoverAnnotations = (config, shape, selectedPrimaryShapeIds, draggedShape) => {
return shape &&
shape.type !== 'annotation' &&
selectedPrimaryShapeIds.indexOf(shape.id) === -1 &&
!draggedShape
? [borderAnnotation(config.hoverAnnotationName, config.hoverLift)(shape)]
: [];
};
export const getHoverAnnotations = (config, shapes, selectedPrimaryShapeIds, draggedShape) =>
shapes
.filter(
shape =>
shape &&
shape.type !== 'annotation' &&
selectedPrimaryShapeIds.indexOf(shape.id) === -1 &&
!draggedShape
)
.map(borderAnnotation(config.hoverAnnotationName, config.hoverLift));

export const getSnappedShapes = (
config,
Expand Down

0 comments on commit be44edc

Please sign in to comment.