MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / intersects

Method intersects

src/main/java/fieldbox/boxes/Drawing.java:114–132  ·  view source on GitHub ↗
(Window.Event<?> event, Box box)

Source from the content-addressed store, hash-verified

112 }
113
114 static public boolean intersects(Window.Event<?> event, Box box) {
115 Rect frame = box.properties.get(Box.frame);
116 if (frame == null) return false;
117
118 Optional<Drawing> drawing = box.find(Drawing.drawing, box.both())
119 .findFirst();
120 if (!drawing.isPresent()) return false;
121
122 Object o = event.after;
123 if (o instanceof Window.HasPosition) {
124 Optional<Vec2> o2 = ((Window.HasPosition) o).position();
125 if (!o2.isPresent()) return false;
126
127 return frame.intersects(drawing.get()
128 .windowSystemToDrawingSystem(o2.get()));
129 }
130
131 return false;
132 }
133
134 /**
135 * call this to request a redraw at the next available animation cycle

Callers 4

FrameManipulationMethod · 0.45
button2Method · 0.45
button0Method · 0.45
startAtMethod · 0.45

Calls 7

intersectsMethod · 0.95
isPresentMethod · 0.80
getMethod · 0.65
positionMethod · 0.65
findMethod · 0.45
bothMethod · 0.45

Tested by

no test coverage detected