From 02aeddd9365418b280ea58408b5821a047c5add1 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Sep 2024 14:35:30 +0800 Subject: [PATCH] * [task#127426] render region input for canvas. --- lib/zin/wg/think3c/js/v1.js | 10 ++++++++++ lib/zin/wg/think3c/v1.php | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index 5323f86d00..dc88ed9386 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -250,6 +250,16 @@ function drawRegionInput(canvas, region, colorIndex, area) color: '#000', backgroundColor: colors[colorIndex % colors.length], }; + + const input = document.createElement('input'); + input.type = 'text'; + input.value = area; + input.id = `input_${colorIndex}`; + input.name = `area[${area}]`; + input.placeholder = area; + Object.assign(input.style, styles); + + canvas.parentNode.appendChild(input); } /** diff --git a/lib/zin/wg/think3c/v1.php b/lib/zin/wg/think3c/v1.php index e91efe4793..b617e7ced6 100644 --- a/lib/zin/wg/think3c/v1.php +++ b/lib/zin/wg/think3c/v1.php @@ -11,11 +11,11 @@ class think3c extends thinkModel return file_get_contents(__DIR__ . DS . 'js' . DS . 'v1.js'); } - protected function buildBody(): array + protected function buildBody(): node { jsVar('modelImg', 'data/thinmory/thumbnail/init3c.png'); - return array(h::canvas(setID('canvas'))); + return div(setCLass('relative'), h::canvas(setID('canvas'))); } protected function build(): node