{"id":12156,"date":"2022-04-02T22:21:40","date_gmt":"2022-04-02T13:21:40","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=12156"},"modified":"2022-04-02T23:29:54","modified_gmt":"2022-04-02T14:29:54","slug":"gwc-ui-library-select%ec%9d%98-custom-draw-setcustomdrawingmethod","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=12156","title":{"rendered":"#GWC UI Library : Select\uc758 Custom Draw (setCustomDrawingMethod)"},"content":{"rendered":"<p>\uc6f9 UI \ub77c\uc774\ube0c\ub7ec\ub9ac\uc778 GWC\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 Select \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc120\ud0dd \ud56d\ubaa9\uc744 \uc0ac\uc6a9\uc790 \uc815\uc758 \uadf8\ub9ac\uae30\ub85c \uc815\uc758\ud558\uae30 \uc704\ud55c  \uc608\uc81c \ucf54\ub4dc\uc785\ub2c8\ub2e4.<\/p>\n<p>\uba3c\uc800 DOM \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">\r\n<div class=\"center\">\r\n    <div class=\"panel\">\r\n        <gwc-label id=\"label\" content=\"Select \uc774\ubca4\ud2b8 \uc815\ubcf4\" outline-type=\"concave\"><\/gwc-label>\r\n        <gwc-select id=\"select\" label=\"\ub77c\uc778 \uc2a4\ud0c0\uc77c\"><\/gwc-select>\r\n        <gwc-button id=\"button\" title=\"\uac12 \ud655\uc778\" \/>\r\n    <\/div>\r\n<\/div>\r\n<\/pre>\n<p>\uadf8\ub9ac\uace0 CSS \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uad6c\uc694.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">\r\n.center {\r\n    display: flex;\r\n    width: 100%;\r\n    height: 100%;\r\n    justify-content: center;\r\n    align-items: center;\r\n}\r\n\r\n.panel {\r\n    display: flex;\r\n    gap: 2em;\r\n    flex-direction: column;\r\n    justify-content: center;\r\n    align-items: center;\r\n}\r\n\r\n#select {\r\n    width: 200px;\r\n}\r\n<\/pre>\n<p>js \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\nwindow.onload = () => {\r\n    select.setCustomDrawingMethod([\r\n        {v: \"4 4\"}, \/\/ \uc0ac\uc6a9\uc790 \uc815\uc758 \uc544\uc774\ud15c\uc744 \uc2dc\uac01\ud654\ud558\uae30 \uc704\ud55c \uc784\uc758\uc758 \ub370\uc774\ud130\r\n        {v: \"8 4\"},\r\n        {v: \"8 8\"},\r\n        {v: \"16 8\"},\r\n        {v: \"16 4\"}\r\n    ], (item) => {\r\n        const domSVG = document.createElementNS(\"http:\/\/www.w3.org\/2000\/svg\", \"svg\");\r\n        domSVG.setAttribute(\"width\", \"100px\");\r\n        domSVG.setAttribute(\"height\", \"20px\");\r\n\r\n        const svgLine = document.createElementNS(\"http:\/\/www.w3.org\/2000\/svg\", \"line\");\r\n        svgLine.setAttribute(\"x1\", 4);\r\n        svgLine.setAttribute(\"y1\", 10);\r\n        svgLine.setAttribute(\"x2\", 96);\r\n        svgLine.setAttribute(\"y2\", 10);\r\n        svgLine.style = `stroke:white;stroke-width:4;stroke-dasharray:${item.v}`;\r\n\r\n        domSVG.appendChild(svgLine);\r\n\r\n        return domSVG;\r\n    });\r\n\r\n    select.selectedIndex = 1;\r\n\r\n    select.addEventListener(\"change\",  (event) => {\r\n        const select = event.target;\r\n        label.content = `\"<span style=\"color:yellow\">${select.value.v}<\/span>\"(\uc73c)\ub85c \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`;\r\n    });\r\n\r\n    button.addEventListener(\"click\", () => {\r\n        gwcMessage(`select\uc758 \uac12: ${select.value.v}`);\r\n    });\r\n\r\n    GeoServiceWebComponentManager.instance.update();\r\n};\r\n<\/pre>\n<p>\uc2e4\ud589 \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><center><video controls=\"controls\" ><source src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2022\/04\/gwc-select-custom.mp4\" \/>\ube44\ub514\uc624\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uc6f9\ube0c\ub77c\uc6b0\uc838\uc785\ub2c8\ub2e4.<\/video><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc6f9 UI \ub77c\uc774\ube0c\ub7ec\ub9ac\uc778 GWC\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 Select \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc120\ud0dd \ud56d\ubaa9\uc744 \uc0ac\uc6a9\uc790 \uc815\uc758 \uadf8\ub9ac\uae30\ub85c \uc815\uc758\ud558\uae30 \uc704\ud55c \uc608\uc81c \ucf54\ub4dc\uc785\ub2c8\ub2e4. \uba3c\uc800 DOM \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. \uadf8\ub9ac\uace0 CSS \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uad6c\uc694. .center { display: flex; width: 100%; height: 100%; justify-content: center; align-items: center; } .panel { display: flex; gap: 2em; flex-direction: column; justify-content: center; align-items: center; } #select { width: &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=12156\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;#GWC UI Library : Select\uc758 Custom Draw (setCustomDrawingMethod)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[140,1],"tags":[],"class_list":["post-12156","post","type-post","status-publish","format-standard","hentry","category-gwc","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/12156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12156"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/12156\/revisions"}],"predecessor-version":[{"id":12161,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/12156\/revisions\/12161"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12156"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}