| 217 | } |
| 218 | |
| 219 | fun error(b: Box, text: String) { |
| 220 | if (b.properties.get(FLineDrawing.frameDrawing) == null) return |
| 221 | b.properties.putToMap(FLineDrawing.frameDrawing, "__tops_error__", java.util.function.Function<Box, FLine> { |
| 222 | |
| 223 | val frame = it.properties.get(Box.frame) |
| 224 | |
| 225 | var f = FLine() |
| 226 | |
| 227 | val shim = 5 |
| 228 | |
| 229 | val O = Math.max(20.0, Math.min(frame.w, frame.h) / 3.0); |
| 230 | f.moveTo((frame.x + frame.w + shim).toDouble(), (frame.y + frame.h - O - shim).toDouble()) |
| 231 | f.lineTo((frame.x + frame.w + shim).toDouble(), (frame.y + frame.h + shim).toDouble()) |
| 232 | f.lineTo((frame.x + frame.w - O - shim).toDouble(), (frame.y + frame.h + shim).toDouble()) |
| 233 | f.lineTo((frame.x + frame.w + shim).toDouble(), (frame.y + frame.h - O - shim).toDouble()) |
| 234 | |
| 235 | f.attributes += StandardFLineDrawing.filled to true |
| 236 | f.attributes += StandardFLineDrawing.stroked to true |
| 237 | f.attributes += StandardFLineDrawing.fillColor to Vec4(0.5, 0, 0, -0.75) |
| 238 | f.attributes += StandardFLineDrawing.strokeColor to Vec4(0.5, 0, 0, 0.75) |
| 239 | |
| 240 | f |
| 241 | }) |
| 242 | |
| 243 | (b.asMap_get("label") as MutableMap<String, String>).put("s", text) |
| 244 | } |
| 245 | |
| 246 | fun noError(b: Box) { |
| 247 | if (b.properties.get(FLineDrawing.frameDrawing) == null) return |
no test coverage detected