{"product_id":"test-bobbin","title":"Test - Bobbin","description":"\u003cbody\u003e\n\n\n\u003cmeta charset=\"UTF-8\"\u003e\n\u003ctitle\u003eCarp Bobbin 37x20mm | 40x27mm Wrap\u003c\/title\u003e\n\u003cstyle\u003e\n  body {\n    margin: 0; display: flex; height: 100vh;\n    background: #1e1e1e; color: #fff;\n    font-family: Arial, sans-serif; overflow: hidden;\n  }\n  #left { flex: 1; position: relative; background: #222; }\n  #c3d { width: 100%; height: 100%; display: block; cursor: grab; }\n  #right {\n    width: 350px; background: #2b2b2b; border-left: 1px solid #444;\n    padding: 15px; overflow-y: auto;\n    display: flex; flex-direction: column; gap: 12px;\n  }\n  h2 {\n    font-size: 16px; border-bottom: 1px solid #444;\n    padding-bottom: 8px; margin: 0;\n  }\n  .lbl { font-size: 12px; color: #bbb; margin-bottom: 4px; }\n  .swatches { display: flex; gap: 6px; flex-wrap: wrap; }\n  .swatch {\n    width: 24px; height: 24px; border-radius: 4px;\n    cursor: pointer; border: 2px solid #555;\n  }\n  .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }\n  button, select, input[type=\"text\"], label.btn {\n    background: #3a3a3a; color: #fff; border: 1px solid #555;\n    padding: 6px 10px; border-radius: 4px; font-size: 13px; cursor: pointer;\n  }\n  button.primary { background: #2563eb; border-color: #3b82f6; }\n  #wrap-box {\n    background: #444; border: 1px solid #666; border-radius: 4px;\n    padding: 8px; display: flex; justify-content: center;\n  }\n  #c2d {\n    width: 280px; height: 189px; display: block;\n    cursor: grab; background: #1e88e5;\n  }\n  #msg {\n    position: absolute; top: 12px; left: 12px;\n    background: rgba(0,0,0,0.7); padding: 6px 10px;\n    border-radius: 4px; font-size: 12px; color: #ccc; pointer-events: none;\n  }\n\u003c\/style\u003e\n\n\n  \u003cdiv id=\"left\"\u003e\n    \u003cdiv id=\"msg\"\u003eDrag horizontally to spin • Scroll to zoom\u003c\/div\u003e\n    \u003ccanvas id=\"c3d\"\u003e\u003c\/canvas\u003e\n  \u003c\/div\u003e\n  \u003cdiv id=\"right\"\u003e\n    \u003ch2\u003eCarp Bobbin (37×20mm)\u003c\/h2\u003e\n    \u003cdiv\u003e\n      \u003cdiv class=\"lbl\"\u003e1. Select Part \u0026amp; Click Color:\u003c\/div\u003e\n      \u003cdiv class=\"swatches\" id=\"swatches\"\u003e\u003c\/div\u003e\n      \u003cdiv class=\"row\" style=\"margin-top:6px;font-size:13px;\"\u003e\n        \u003clabel\u003e\u003cinput type=\"checkbox\" id=\"chk-body\" checked\u003e Body\u003c\/label\u003e\n        \u003clabel\u003e\u003cinput type=\"checkbox\" id=\"chk-iso\"\u003e Isotope\u003c\/label\u003e\n        \u003clabel\u003e\u003cinput type=\"checkbox\" id=\"chk-met\"\u003e Metal\u003c\/label\u003e\n      \u003c\/div\u003e\n    \u003c\/div\u003e\n    \u003cdiv\u003e\n      \u003cdiv class=\"lbl\"\u003e2. Body Finish:\u003c\/div\u003e\n      \u003cselect id=\"finish\" style=\"width:100%;\"\u003e\n        \u003coption value=\"acrylic\"\u003eTranslucent Acrylic\u003c\/option\u003e\n        \u003coption value=\"ptfe\"\u003eSolid PTFE Matte\u003c\/option\u003e\n      \u003c\/select\u003e\n    \u003c\/div\u003e\n    \u003cdiv\u003e\n      \u003cdiv class=\"lbl\"\u003e3. Body Wrap (Landscape 40 × 27 mm):\u003c\/div\u003e\n      \u003cdiv id=\"wrap-box\"\u003e\n        \u003ccanvas id=\"c2d\" width=\"400\" height=\"270\"\u003e\u003c\/canvas\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"row\" style=\"margin-top:6px;\"\u003e\n        \u003clabel class=\"btn\" style=\"flex:1;text-align:center;\"\u003e\n          Upload Logo\n          \u003cinput type=\"file\" id=\"file-img\" accept=\"image\/*\" style=\"display:none;\"\u003e\n        \u003c\/label\u003e\n        \u003cbutton id=\"btn-in\" title=\"Larger\"\u003e+\u003c\/button\u003e\n        \u003cbutton id=\"btn-out\" title=\"Smaller\"\u003e-\u003c\/button\u003e\n        \u003cbutton id=\"btn-clear\"\u003eClear\u003c\/button\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"row\" style=\"margin-top:6px;\"\u003e\n        \u003cinput type=\"text\" id=\"txt-val\" placeholder=\"Custom text...\" style=\"flex:1;\"\u003e\n        \u003cinput type=\"color\" id=\"txt-col\" value=\"#ffffff\"\u003e\n        \u003cbutton id=\"btn-txt\"\u003eAdd\u003c\/button\u003e\n      \u003c\/div\u003e\n    \u003c\/div\u003e\n    \u003cdiv class=\"row\" style=\"margin-top:auto;padding-top:8px;border-top:1px solid #444;\"\u003e\n      \u003clabel style=\"font-size:13px;\"\u003e\n        \u003cinput type=\"checkbox\" id=\"chk-spin\" checked\u003e Spin\n      \u003c\/label\u003e\n      \u003cinput type=\"color\" id=\"bg-col\" value=\"#222222\" title=\"Background\"\u003e\n      \u003cbutton id=\"btn-wrap\" style=\"margin-left:auto;\"\u003eSave Wrap\u003c\/button\u003e\n      \u003cbutton id=\"btn-snap\" class=\"primary\"\u003eSave PNG\u003c\/button\u003e\n    \u003c\/div\u003e\n  \u003c\/div\u003e\n\n\u003cscript\u003e\nvar st = {\n  body: '#1e88e5',\n  iso: '#00ff66',\n  metal: '#242424',\n  bg: '#222222',\n  finish: 'acrylic',\n  angle: 0.4,\n  zoom: 1.0\n};\n\nvar c2d = document.getElementById('c2d');\nvar ctx2 = c2d.getContext('2d');\nvar items = [\n  { type: 'text', text: 'CARP 37', x: 125, y: 120, color: '#ffffff', w: 150, h: 32 }\n];\nvar drag = null;\nvar ox = 0;\nvar oy = 0;\nvar spin = false;\nvar lx = 0;\n\nfunction drawWrap() {\n  ctx2.fillStyle = st.body;\n  ctx2.fillRect(0, 0, 400, 270);\n  for (var i = 0; i \u003c items.length; i++) {\n    var it = items[i];\n    if (it.type === 'img') {\n      ctx2.drawImage(it.img, it.x, it.y, it.w, it.h);\n    } else {\n      ctx2.fillStyle = it.color;\n      ctx2.font = 'bold 32px Arial,sans-serif';\n      ctx2.textBaseline = 'top';\n      ctx2.fillText(it.text, it.x, it.y);\n      it.w = ctx2.measureText(it.text).width;\n      it.h = 32;\n    }\n  }\n}\n\nc2d.onmousedown = function(e) {\n  var r = c2d.getBoundingClientRect();\n  var mx = (e.clientX - r.left) * (400 \/ r.width);\n  var my = (e.clientY - r.top) * (270 \/ r.height);\n  for (var i = items.length - 1; i \u003e= 0; i--) {\n    var it = items[i];\n    if (mx \u003e= it.x \u0026\u0026 mx \u003c= it.x + it.w \u0026\u0026 my \u003e= it.y \u0026\u0026 my \u003c= it.y + it.h) {\n      drag = it;\n      ox = mx - it.x;\n      oy = my - it.y;\n      break;\n    }\n  }\n};\n\nvar c3d = document.getElementById('c3d');\nvar ctx = c3d.getContext('2d');\n\nfunction resize() {\n  var box = document.getElementById('left');\n  c3d.width = box.clientWidth || (window.innerWidth - 350);\n  c3d.height = box.clientHeight || window.innerHeight;\n}\nwindow.onresize = resize;\nresize();\n\nc3d.onmousedown = function(e) {\n  spin = true;\n  lx = e.clientX;\n};\n\nc3d.onwheel = function(e) {\n  e.preventDefault();\n  st.zoom = Math.max(0.5, Math.min(2.0, st.zoom - e.deltaY * 0.001));\n};\n\nwindow.onmousemove = function(e) {\n  if (drag) {\n    var r = c2d.getBoundingClientRect();\n    drag.x = (e.clientX - r.left) * (400 \/ r.width) - ox;\n    drag.y = (e.clientY - r.top) * (270 \/ r.height) - oy;\n    drawWrap();\n  }\n  if (spin) {\n    st.angle += (e.clientX - lx) * 0.012;\n    lx = e.clientX;\n  }\n};\n\nwindow.onmouseup = function() {\n  drag = null;\n  spin = false;\n};\n\nfunction drawBobbin() {\n  var W = c3d.width;\n  var H = c3d.height;\n  var cx = W \/ 2;\n  var cy = H \/ 2;\n  var showIso = document.getElementById('chk-iso').checked;\n\n  ctx.fillStyle = st.bg;\n  ctx.fillRect(0, 0, W, H);\n\n  ctx.strokeStyle = 'rgba(255,255,255,0.08)';\n  var hor = cy + 140 * st.zoom;\n  for (var i = -8; i \u003c= 8; i++) {\n    ctx.beginPath();\n    ctx.moveTo(cx + i * 35 * st.zoom, hor);\n    ctx.lineTo(cx + i * 130 * st.zoom, H);\n    ctx.stroke();\n  }\n\n  var bw = 140 * st.zoom;\n  var bh = bw * 1.85;\n  var topY = cy - bh \/ 2;\n  var botY = cy + bh \/ 2;\n  var r = bw \/ 2;\n\n  ctx.fillStyle = st.metal;\n  ctx.fillRect(cx - r * 0.3, botY, r * 0.6, 20 * st.zoom);\n  for (var k = 0; k \u003c 4; k++) {\n    var ly = botY + (28 + k * 15) * st.zoom;\n    ctx.fillStyle = '#666';\n    ctx.fillRect(cx - 2, ly - 8 * st.zoom, 4, 8 * st.zoom);\n    ctx.fillStyle = st.metal;\n    ctx.beginPath();\n    ctx.arc(cx, ly, 6 * st.zoom, 0, Math.PI * 2);\n    ctx.fill();\n  }\n\n  ctx.fillStyle = st.metal;\n  ctx.fillRect(cx - r * 0.28, topY - 18 * st.zoom, r * 0.56, 18 * st.zoom);\n  ctx.fillRect(cx - r * 0.22, topY - 42 * st.zoom, r * 0.1, 26 * st.zoom);\n  ctx.fillRect(cx + r * 0.12, topY - 42 * st.zoom, r * 0.1, 26 * st.zoom);\n  ctx.fillStyle = '#e2e8f0';\n  ctx.beginPath();\n  ctx.arc(cx - r * 0.08, topY - 38 * st.zoom, 7.5 * st.zoom, 0, Math.PI * 2);\n  ctx.arc(cx + r * 0.08, topY - 38 * st.zoom, 7.5 * st.zoom, 0, Math.PI * 2);\n  ctx.fill();\n\n  if (showIso \u0026\u0026 st.finish === 'acrylic') {\n    ctx.save();\n    ctx.shadowColor = st.iso;\n    ctx.shadowBlur = 20 * st.zoom;\n    ctx.fillStyle = st.iso;\n    ctx.fillRect(cx - 7 * st.zoom, cy - bh * 0.32, 14 * st.zoom, bh * 0.64);\n    ctx.restore();\n  }\n\n  ctx.globalAlpha = (st.finish === 'acrylic') ? 0.78 : 1.0;\n  for (var s = 0; s \u003c 80; s++) {\n    var t1 = -Math.PI \/ 2 + (s \/ 80) * Math.PI;\n    var t2 = -Math.PI \/ 2 + ((s + 1) \/ 80) * Math.PI;\n    var x1 = cx + Math.sin(t1) * r;\n    var x2 = cx + Math.sin(t2) * r;\n    var sw = Math.ceil(x2 - x1);\n    if (sw \u003c= 0) continue;\n    var u = ((t1 + st.angle) \/ (Math.PI * 2)) % 1;\n    if (u \u003c 0) u += 1;\n    ctx.drawImage(c2d, Math.floor(u * 398), 0, 2, 270, x1, topY, sw, bh);\n  }\n  ctx.globalAlpha = 1.0;\n\n  var grad = ctx.createLinearGradient(cx - r, 0, cx + r, 0);\n  grad.addColorStop(0, 'rgba(0,0,0,0.55)');\n  grad.addColorStop(0.25, 'rgba(255,255,255,0.28)');\n  grad.addColorStop(0.5, 'rgba(255,255,255,0)');\n  grad.addColorStop(0.85, 'rgba(0,0,0,0.35)');\n  grad.addColorStop(1, 'rgba(0,0,0,0.65)');\n  ctx.fillStyle = grad;\n  ctx.fillRect(cx - r, topY, bw, bh);\n\n  if (showIso) {\n    var slotA = ((st.angle + Math.PI) % (Math.PI * 2)) - Math.PI;\n    if (Math.abs(slotA) \u003c Math.PI \/ 2) {\n      var slotX = cx + Math.sin(slotA) * (r * 0.92);\n      var slotW = Math.max(2, 14 * st.zoom * Math.cos(slotA));\n      var slotH = bh * 0.6;\n      ctx.fillStyle = st.metal;\n      ctx.fillRect(slotX - slotW \/ 2 - 2, cy - slotH \/ 2 - 2, slotW + 4, slotH + 4);\n      ctx.fillStyle = st.iso;\n      ctx.fillRect(slotX - slotW \/ 2, cy - slotH \/ 2, slotW, slotH);\n    }\n  }\n}\n\nvar palette = [\n  '#1e88e5', '#00e676', '#ff1744', '#ff9100',\n  '#ffea00', '#d500f9', '#f5f5f5', '#212121'\n];\n\npalette.forEach(function(hex) {\n  var d = document.createElement('div');\n  d.className = 'swatch';\n  d.style.background = hex;\n  d.onclick = function() {\n    if (document.getElementById('chk-body').checked) { st.body = hex; drawWrap(); }\n    if (document.getElementById('chk-iso').checked) { st.iso = hex; }\n    if (document.getElementById('chk-met').checked) { st.metal = hex; }\n  };\n  document.getElementById('swatches').appendChild(d);\n});\n\ndocument.getElementById('finish').onchange = function(e) {\n  st.finish = e.target.value;\n};\n\ndocument.getElementById('bg-col').oninput = function(e) {\n  st.bg = e.target.value;\n};\n\ndocument.getElementById('file-img').onchange = function(e) {\n  var f = e.target.files[0];\n  if (!f) return;\n  var rd = new FileReader();\n  rd.onload = function(ev) {\n    var img = new Image();\n    img.onload = function() {\n      var sc = Math.max(400 \/ img.width, 270 \/ img.height);\n      var w = img.width * sc;\n      var h = img.height * sc;\n      items.unshift({ type: 'img', img: img, x: (400 - w) \/ 2, y: (270 - h) \/ 2, w: w, h: h });\n      drawWrap();\n    };\n    img.src = ev.target.result;\n  };\n  rd.readAsDataURL(f);\n  e.target.value = '';\n};\n\nfunction scaleImg(f) {\n  for (var i = 0; i \u003c items.length; i++) {\n    if (items[i].type === 'img') {\n      var it = items[i];\n      var ow = it.w;\n      var oh = it.h;\n      it.w *= f;\n      it.h *= f;\n      it.x -= (it.w - ow) \/ 2;\n      it.y -= (it.h - oh) \/ 2;\n    }\n  }\n  drawWrap();\n}\n\ndocument.getElementById('btn-in').onclick = function() { scaleImg(1.15); };\ndocument.getElementById('btn-out').onclick = function() { scaleImg(0.85); };\n\ndocument.getElementById('btn-txt').onclick = function() {\n  var t = document.getElementById('txt-val').value.trim();\n  if (!t) return;\n  var col = document.getElementById('txt-col').value;\n  items.push({ type: 'text', text: t, x: 100, y: 120, color: col, w: 100, h: 32 });\n  document.getElementById('txt-val').value = '';\n  drawWrap();\n};\n\ndocument.getElementById('btn-clear').onclick = function() {\n  items.length = 0;\n  drawWrap();\n};\n\ndocument.getElementById('btn-wrap').onclick = function() {\n  var a = document.createElement('a');\n  a.download = 'bobbin-wrap-40x27mm.png';\n  a.href = c2d.toDataURL('image\/png');\n  a.click();\n};\n\ndocument.getElementById('btn-snap').onclick = function() {\n  var a = document.createElement('a');\n  a.download = 'carp-bobbin-37x20mm.png';\n  a.href = c3d.toDataURL('image\/png');\n  a.click();\n};\n\ndrawWrap();\n\nfunction loop() {\n  if (document.getElementById('chk-spin').checked \u0026\u0026 !spin) {\n    st.angle += 0.015;\n  }\n  drawBobbin();\n  requestAnimationFrame(loop);\n}\nloop();\n\u003c\/script\u003e\n\n\u003c\/body\u003e","brand":"Custom Tackle","offers":[{"title":"Default Title","offer_id":56522008592769,"sku":null,"price":0.0,"currency_code":"GBP","in_stock":false}],"url":"https:\/\/www.customtackle.co.uk\/products\/test-bobbin","provider":"Custom Tackle","version":"1.0","type":"link"}