{"id":7531,"date":"2021-12-03T08:30:24","date_gmt":"2021-12-02T23:30:24","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7531"},"modified":"2021-12-04T01:48:05","modified_gmt":"2021-12-03T16:48:05","slug":"deck-gl%e3%81%a7%e3%83%9e%e3%82%a6%e3%82%b9%e3%82%ab%e3%83%bc%e3%82%bd%e3%83%ab%e3%82%92%e5%a4%89%e6%9b%b4%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7531","title":{"rendered":"deck.gl\u3067\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u5909\u66f4\u3059\u308b"},"content":{"rendered":"\n<p> \u3053\u306e\u8a18\u4e8b\u306f<a href=\"https:\/\/qiita.com\/advent-calendar\/2021\/deckgl\">deck.gl Advent Calendar 2021 <\/a>\u53c2\u52a0\u8a18\u4e8b\u3067\u3059\u3002  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>deck.gl\u3067\u751f\u6210\u3055\u308c\u308b\u5730\u56f3\u306f\u5358\u4e00\u306ecanvas\u306b\u63cf\u753b\u3055\u308c\u308b\u305f\u3081\u3001\u5730\u56f3\u5185\u306e\u5730\u7269\u306b\u30db\u30d0\u30fc\u3057\u305f\u969b\u306b\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u5909\u5316\u3055\u305b\u308b\u306b\u306fdeck.gl\u306eonHover\u30a4\u30d9\u30f3\u30c8\u3067\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/embed\/hobasitashi-nikasoruwobian-hua-saseru-h1gw9?autoresize=1&amp;fontsize=12&amp;hidenavigation=1&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"\u30db\u30d0\u30fc\u3057\u305f\u6642\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u5909\u5316\u3055\u305b\u308b\" allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\" sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"><\/iframe>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u8aac<\/h2>\n\n\n\n<p>deck.gl\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u306f\u3001getCursor\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u7528\u3044\u308b\u3053\u3068\u3067canvas\u306b\u30db\u30d0\u30fc\u3057\u305f\u969b\u306e\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002 getCursor\u30d7\u30ed\u30d1\u30c6\u30a3\u3068onHover\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5229\u7528\u3057\u3066\u7279\u5b9a\u306e\u30ec\u30a4\u30e4\u30fc\u4e0a\u306b\u30db\u30d0\u30fc\u3057\u305f\u3068\u304d\u306e\u307f\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \">\/\/\u30ab\u30fc\u30bd\u30eb\u30b9\u30c6\u30fc\u30bf\u30b9\nconst [cursor, setCursor] = useState(\"move\");\n\n\/\/\u5730\u7269\u306b\u30de\u30a6\u30b9\u30aa\u30fc\u30d0\u30fc\u3057\u305f\u969b\u306e\u51e6\u7406\nconst hoverHandle = (d) =&gt; {\n    \/\/\u30db\u30d0\u30fc\u4e0b\u306b\u30ec\u30a4\u30e4\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306f\u30dd\u30a4\u30f3\u30bf\u30fc\u306b\n    if (d.layer) {\n        setCursor(\"pointer\");\n        \/* \/\/\u7279\u5b9a\u306e\u30ec\u30a4\u30e4\u30fc\u3067\u306e\u307f\u5909\u66f4\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u30ec\u30a4\u30e4\u30fcid\u3067\u5224\u5225\u3059\u308b\n        if(d.layer.id == \"geojson-layer\"){\n          setCursor(\"crosshair\");\n        }\n        *\/\n    } else {\n        \/\/\u30ec\u30a4\u30e4\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\u79fb\u52d5\u30ab\u30fc\u30bd\u30eb\u306b\u5909\u66f4\n        setCursor(\"move\");\n    }\n};\n\n\nreturn (\n    &lt;DeckGL\n        getCursor={() =&gt; cursor}\n        onHover={hoverHandle}\n    \/&gt;\n)<\/pre><\/div>\n\n\n\n<p>\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u7ba1\u7406\u3059\u308b\u5909\u6570\u3092\u4f5c\u6210\u3057\u3001getCursor\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u6e21\u3057\u307e\u3059\u3002\uff08getCursor\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u306f\u5fc5\u305afunction\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n\n\n\n<p>onHover\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30db\u30d0\u30fc\u6642\u306b\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u4e2d\u3067\u306f\u3001\u5f15\u6570\u304b\u3089\u30ec\u30a4\u30e4\u30fc\u306e\u6709\u7121\u3084\u30ec\u30a4\u30e4\u30fcID\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u305d\u308c\u3089\u306e\u60c5\u5831\u3092\u5143\u306b\u30ab\u30fc\u30bd\u30eb\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306fdeck.gl Advent Calen&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7539,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deck-gl","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=7531"}],"version-history":[{"count":8,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7531\/revisions"}],"predecessor-version":[{"id":7747,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7531\/revisions\/7747"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7539"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}