{"id":4214,"date":"2015-04-17T09:53:56","date_gmt":"2015-04-17T00:53:56","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=4214"},"modified":"2015-05-07T16:58:37","modified_gmt":"2015-05-07T07:58:37","slug":"post-4214","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/4214","title":{"rendered":"[leaflet]\u5730\u56f3\u30bf\u30a4\u30eb\u753b\u50cf\u306bCSS\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u9069\u7528\u3059\u308b"},"content":{"rendered":"<p><a href=\"http:\/\/shimz.me\/example\/leaflet\/cssFilter\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504161.jpg\" alt=\"leaflet css filter\" width=\"690\" height=\"528\" class=\"aligncenter size-full wp-image-4215 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504161.jpg 690w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504161-196x150.jpg 196w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/leaflet\/cssFilter\/\">example<\/a><\/p>\n<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/4200\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3067\u306f\u3001\u91cd\u306d\u305f\u30ec\u30a4\u30e4\u30fc\u3092CSS\u30af\u30ea\u30c3\u30d7\u3092\u4f7f\u3063\u3066\u8868\u793a\u9818\u57df\u3092\u64cd\u4f5c\u3057\u3066\u3044\u307e\u3059\u304c\u3001CSS Clip\u304c\u52b9\u304f\u306e\u3067\u3042\u308c\u3070CSS Filter\u3060\u3063\u3066\u52b9\u304f\u3060\u308d\u3046\u3068\u601d\u3063\u3066\u3084\u3063\u3066\u307f\u305f\u306e\u304c\u4e0a\u8a18\u3067\u3059\u3002<\/p>\n<p>\u5730\u56f3\u30bf\u30a4\u30eb\u753b\u50cf\u306b\u5bfe\u3057\u3066CSS Filter\u3092\u9069\u7528\u3057\u30b3\u30f3\u30b9\u30c8\u30e9\u30b9\u30c8\u3084\u5f69\u5ea6\u3001\u30dc\u30ab\u30b7\u306a\u3069\u306e\u753b\u50cf\u51e6\u7406\u3092\u884c\u3044\u5897\u3059\u3002CSS Filter\u306b\u306f\u4ed6\u306b\u3082\u30bb\u30d4\u30a2\u5316\u3084\u30b0\u30ec\u30a4\u30b9\u30b1\u30fc\u30eb\u5316\u306a\u3069\u306e\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u91cd\u306d\u304c\u3051\u3059\u308b\u306e\u304c\u96e3\u3057\u304b\u3063\u305f\u306e\u3067\u5916\u3057\u3066\u3042\u308a\u307e\u3059\u3002\u8208\u5473\u3042\u308b\u65b9\u306f\u8a66\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u6700\u65b0\u306eChrome\u3068Firefox\u3067\u306f\u52d5\u304f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u304c\u3001IE\u3067\u306f\u52d5\u304d\u307e\u305b\u3093\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p>\u4e0a\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u3044\u308d\u3044\u308d\u3054\u3061\u3083\u3054\u3061\u3083\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u9069\u7528\u3059\u308b\u3060\u3051\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u3066\u304a\u304d\u307e\u3059\u3002<br \/>\n\u300c<a href=\"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/4200\">\u6226\u5f8c\u30fb\u5fa9\u8208\u671f\u3068\u73fe\u5728\u306e\u7a7a\u4e2d\u5199\u771f\u3092\u91cd\u306d\u3066\u6bd4\u8f03\u3057\u3066\u307f\u305f<\/a>\u300d\u306e\u30b3\u30fc\u30c9\u3068\u307b\u3068\u3093\u3069\u5909\u308f\u308a\u307e\u305b\u3093\u300238\u884c\u76ee\u3067css\u30d5\u30a3\u30eb\u30bf\u30fc(\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8)\u3092\u9069\u7528\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/shimz.me\/example\/leaflet\/cssFilter\/contrast.html\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504162.jpg\" alt=\"Leaflet Ccontrasts Filter example\" width=\"690\" height=\"461\" class=\"aligncenter size-full wp-image-4216 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504162.jpg 690w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletcssfilter1504162-225x150.jpg 225w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/leaflet\/cssFilter\/contrast.html\">example<\/a> <\/p>\n<pre class=\"lang:js mark:38 decode:true \" >var ort = L.tileLayer(\r\n  'http:\/\/cyberjapandata.gsi.go.jp\/xyz\/ort\/{z}\/{x}\/{y}.jpg', {\r\n    attribution: \"GSI Ortho\", maxNativeZoom: 17, maxZoom: 20\r\n});\r\n\r\nvar rapid1880 = L.tileLayer(\r\n  'http:\/\/www.finds.jp\/ws\/tmc\/1.0.0\/Kanto_Rapid-900913-L\/{z}\/{x}\/{y}.png', {\r\n    attribution: \"NIAES, NARO\", maxNativeZoom: 15, maxZoom: 17\r\n});\r\n\r\n\r\nvar map = L.map('mapdiv', {\r\n\tcenter: [35.6768, 139.7218],\r\n\tzoom: 16,\r\n\tlayers: [ort, rapid1880],\r\n\tzoomControl: false\r\n});\r\n\r\nnew L.Control.Zoom({ position: 'bottomright' }).addTo(map);\r\nvar hash = L.hash(map);\r\n\r\nvar rangeX = document.querySelector('.rangeX');\r\nvar filterRange = document.querySelector('.filterRange');\r\n\r\nfunction clip() {\r\n\tvar nw = map.containerPointToLayerPoint([0, 0]);\t\/\/\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u5de6\u4e0a\u5ea7\u6a19(North West)\r\n\tvar se = map.containerPointToLayerPoint(map.getSize());\t\/\/\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u53f3\u4e0b\u5ea7\u6a19(South East)\r\n\r\n\tvar clipX = nw.x + (se.x - nw.x) * rangeX.value;\t\/\/x\u8ef8\u53f3\u5ea7\u6a19( * 0.5 \u3067x\u8ef8\u4e2d\u5fc3\u5ea7\u6a19)\r\n\tvar val =  filterRange.value; \t\r\n\t  \t  \r\n\tvar container =  rapid1880.getContainer();\r\n\t  \r\n\t\/\/css clip\u3092\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u306b\u9069\u7528\u3059\u308b rect\uff08\u4e0a,\u53f3,\u4e0b,\u5de6\uff09\r\n\tcontainer.style.clip = 'rect(' + [nw.y, clipX, se.y , nw.x].join('px,') + 'px)';\r\n\r\n\t\/\/css\u30d5\u30a3\u30eb\u30bf\u3092\u9069\u7528\u3059\u308b\r\n\tcontainer.style['webkitFilter' in container.style ? 'webkitFilter' : 'filter']  = 'contrast('+val+')'; \r\n\t\r\n}\r\n\r\n\r\n\/\/\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u3066oninput\u304c\u5b58\u5728\u3059\u308b\u304b\u8abf\u3079\u3066\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u308b\r\nrangeX['oninput' in rangeX ? 'oninput' : 'onchange'] = clip;\r\nfilterRange['oninput' in filterRange ? 'oninput' : 'onchange'] = clip;\r\n\r\nmap.on('move', clip);\r\n\r\nclip();<\/pre>\n<h2>\u900f\u660e\u5ea6\u3092\u64cd\u4f5c\u3059\u308b<\/h2>\n<p>\u753b\u9762\u4e0a\u4f4d\u306e\u30b9\u30e9\u30a4\u30c0\u30fc\u3092\u64cd\u4f5c\u3059\u308b\u3068\u30ec\u30a4\u30e4\u30fc\u306e\u900f\u660e\u5ea6\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u304c\u4e00\u756a\u5b9f\u7528\u7684\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/leaflet\/cssFilter\/opacity.html\">example<\/a><\/p>\n<h2>\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3046<\/h2>\n<p>\u4ee5\u524d\u306e\u8a18\u4e8b\u3067\u3059\u304c\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u3067CSS\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u30bf\u30a4\u30eb\u753b\u50cf\u306b\u9069\u7528\u3059\u308b\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/map\/3696\">[leaflet]\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u3067\u306e\u753b\u50cf\u51e6\u7406\u3092\u53ef\u80fd\u306b\u3059\u308b\u300ctilefilter\u300d\u30d7\u30e9\u30b0\u30a4\u30f3<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>example \u3053\u3061\u3089\u306e\u8a18\u4e8b\u3067\u306f\u3001\u91cd\u306d\u305f\u30ec\u30a4\u30e4\u30fc\u3092&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4215,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-4214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-leaflet-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4214","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=4214"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4214\/revisions"}],"predecessor-version":[{"id":4218,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4214\/revisions\/4218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/4215"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=4214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=4214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=4214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}