Add crop outline rendering and step counter refinement in machine_1

- Implement `drawCropOutLine` method for rendering horizontal crop outlines in machine images.
- Refactor `drawStepCounterOnButton` with dynamic font sizing and fallback handling for better text alignment.
- Add step counter rendering in top-right position for enhanced button visuals.
- Update `exampleRoute` debugging logic to integrate new `machine_1` functionality.
- Replace old debug assets with new button highlight state assets.
This commit is contained in:
Jeppe Bundgaard
2026-01-29 15:18:37 +01:00
parent db99b293de
commit 9e58370e94
5 changed files with 104 additions and 17 deletions
+13 -16
View File
@@ -4,6 +4,7 @@ namespace routes;
use classes\entra;
use classes\redis;
use dynamicimages\images\machine_1;
use goals\classes\goals;
use goals\classes\goals_criteria;
use objects\departments_o;
@@ -53,22 +54,18 @@ class exampleRoute
$this->get('/debug', function () {
global $response;
$criteria = (new goals_criteria());
$criteria->type = \goals\helpers\goals_criteria_type::PRODUCT;
$criteria->target = 100;
$criteria->products->add((new products_o())->select(1));
$criteria->users->add((new users_o())->getUserByCustomerNumber(12345679));
$criteria->departments->add([
(new departments_o())->select(1),
(new departments_o())->select(2),
(new departments_o())->select(3),
]);
$criteria->setTimeframe(new \DateTime('2026-01-01'), new \DateTime('2026-01-31'));
$goal = new goals($criteria);
echo 'Result: ' . $goal->getResult() . PHP_EOL;
echo 'Percentage: ' . $goal->getPercentage() . '%' . PHP_EOL;
echo 'Remaining: ' . $goal->getRemaining() . PHP_EOL;
$response->success(['message' => 'Debugging route!']);
//$response->success(['message' => 'Debugging route!']);
$machine_1 = new machine_1();
//$machine_1->debugAssets();
$machine_1->current_step = 0;
$machine_1->only_generate_current_step = false;
$machine_1->highlighted_buttons = [
0, 2, 4, 7
];
$machine_1->setup();
$machine_1->servePicture();
exit;
$response->success(['message' => 'Debugging route!', 'base64_image' => $machine_1->exportAsBase64()]);
});
}
}