From 94183f7f18c8186a584085183c6a40f78bda74c4 Mon Sep 17 00:00:00 2001 From: zero41120 Date: Thu, 6 Feb 2020 13:50:15 -0800 Subject: [PATCH] 1540 Change innerHTML to value to sync user input --- test/demo/cropping-polygons.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/demo/cropping-polygons.html b/test/demo/cropping-polygons.html index 0e523f4d..071e8405 100644 --- a/test/demo/cropping-polygons.html +++ b/test/demo/cropping-polygons.html @@ -79,7 +79,7 @@ // Load default examples function loadExample(){ polygonList = JSON.parse(JSON.stringify(examples)); - previewEl.innerHTML = JSON.stringify(polygonList); + previewEl.value = JSON.stringify(polygonList); } loadExample(); @@ -91,7 +91,7 @@ p.x = Math.round((p.x + Number.EPSILON) * 100) / 100 p.y = Math.round((p.y + Number.EPSILON) * 100) / 100 polygon.push([p.x, p.y]); - polygonEl.innerHTML += '['+p.x+','+ p.y+']'; + polygonEl.value += '['+p.x+','+ p.y+']'; }); // Add clicked points to polygon tracker variable @@ -99,13 +99,13 @@ if (polygon.length == 0) { return; } polygonList.push(polygon); polygon = []; - polygonEl.innerHTML = ''; - previewEl.innerHTML = JSON.stringify(polygonList); + polygonEl.value = ''; + previewEl.value = JSON.stringify(polygonList); }; document.getElementById('cropBtn').onclick = function(){ - polygonList = JSON.parse(previewEl.innerHTML); - polygonEl.innerHTML = ''; + polygonList = JSON.parse(previewEl.value); + polygonEl.value = ''; var tiledImage = viewer.world.getItemAt(0); tiledImage.setCroppingPolygons(polygonList); viewer.forceRedraw(); @@ -114,8 +114,8 @@ document.getElementById('resetBtn').onclick = function(){ polygonList = [] polygon = [] - polygonEl.innerHTML = ''; - previewEl.innerHTML = ''; + polygonEl.value = ''; + previewEl.value = ''; var tiledImage = viewer.world.getItemAt(0); tiledImage.resetCroppingPolygons(); viewer.forceRedraw();