leaflet-polydraw
Version:
Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tool
452 lines (406 loc) • 9.37 kB
CSS
/* Add application styles & imports to this file! */
html,
body {
height: 100%;
}
#blitz-app {
height: 100%;
}
.polygon-marker {
background-color: #e0f8c5;
box-shadow:
0 0 0 2px #50622b,
0 0 10px rgba(0, 0, 0, 0.35);
width: 12px ;
height: 12px ;
margin-left: -6px ;
margin-top: -6px ;
border-radius: 50%;
cursor: move;
outline: none;
transition: background-color 0.25s;
}
.polygon-marker.menu {
margin-left: -11px ;
margin-top: -11px ;
background-color: rgb(134, 162, 214);
background-image: url('../icons/icon-settings-white.svg');
-ms-background-size: 20px 20px;
background-size: 20px 20px;
background-repeat: no-repeat;
background-position: center;
width: 24px ;
height: 24px ;
z-index: 10000;
cursor: pointer;
}
.polygon-marker.info {
margin-left: -11px ;
margin-top: -11px ;
background-color: rgb(134, 162, 214);
background-image: url('../icons/icon-info-white.svg');
-ms-background-size: 24px 24px;
background-size: 24px 24px;
background-repeat: no-repeat;
background-position: center;
width: 24px ;
height: 24px ;
z-index: 10000;
cursor: pointer;
}
.polygon-marker:hover {
width: 18px ;
height: 18px ;
margin-left: -9px ;
margin-top: -9px ;
}
.polygon-marker.menu:hover {
background-color: red;
width: 24px ;
height: 24px ;
z-index: 10000;
margin-left: -11px ;
margin-top: -11px ;
}
.polygon-marker.info:hover {
background-color: rgb(134, 162, 214);
width: 24px ;
height: 24px ;
z-index: 10000;
margin-left: -11px ;
margin-top: -11px ;
}
.polygon-marker.delete {
margin-left: -11px ;
margin-top: -11px ;
background-color: rgb(100, 93, 93);
background-image: url('../icons/icon-trash-white.svg');
-ms-background-size: 24px 24px;
background-size: 24px 24px;
background-repeat: no-repeat;
background-position: center;
width: 24px ;
height: 24px ;
z-index: 10000;
cursor: pointer;
}
.polygon-marker.delete:hover {
background-color: rgb(92, 81, 81);
background-image: url('../icons/icon-trash-hover-white.svg');
width: 24px ;
height: 24px ;
z-index: 10000;
margin-left: -11px ;
margin-top: -11px ;
}
.polygon-marker.hole {
background-color: #ffcccc;
box-shadow:
0 0 0 2px #aa0000,
0 0 10px rgba(0, 0, 0, 0.35);
width: 12px ;
height: 12px ;
margin-left: -6px ;
margin-top: -6px ;
border-radius: 50%;
cursor: move;
outline: none;
transition: background-color 0.25s;
}
.polygon-marker.hole:hover {
background-color: #d4a5b8;
width: 18px ;
height: 18px ;
margin-left: -9px ;
margin-top: -9px ;
}
.marker-menu-inner-wrapper {
display: flex;
flex-direction: column;
}
.marker-menu-header {
font-weight: 600;
}
.marker-menu-content {
display: flex;
justify-content: space-between;
}
.marker-menu-button {
padding: 4px;
border: 1px solid #aaaaaa;
}
.marker-menu-separator {
padding: 4px;
}
.info-marker,
.alter-marker {
background-color: blue;
width: 100%;
display: flex;
flex-direction: row-reverse;
a.leaflet-popup-close-button {
top: -12px;
right: -12.5px;
z-index: 3;
color: #fff;
&:hover {
color: #fff;
}
}
.leaflet-popup-content-wrapper {
background: #e93434;
color: #ffffff;
.leaflet-popup-content {
margin: 0;
line-height: 1.4;
}
}
.leaflet-popup-content-wrapper {
padding: 0;
}
}
.alter-marker-outer-wrapper,
.info-marker-outer-wrapper {
overflow: hidden;
background-color: #80be50;
border-radius: 12px;
padding-right: 16px;
box-shadow: 3px 4px 20px #00000080;
}
.alter-marker-wrapper,
.info-marker-wrapper {
height: 40px;
border: 2px solid transparent;
background-color: #80be50;
color: #fff;
padding: 0 6px;
text-align: center;
border-radius: 12px;
text-align: center;
}
.content {
width: 100%;
min-height: 40px;
margin-right: 12px;
}
.marker-menu-content {
.marker-menu-button {
width: 22px;
height: 22px;
background-repeat: no-repeat;
background-size: 22px, 22px;
background-position: center;
padding: 4px;
border: 1px solid #fff;
margin: 4px;
border-radius: 4px;
cursor: pointer;
&.simplify {
background-image: url('../icons/icon-simplify2.svg');
}
&.double-elbows {
background-image: url('../icons/icon-add-elbow.svg');
}
&.bbox {
background-image: url('../icons/icon-bbox.svg');
}
&.bezier {
background-image: url('../icons/icon-bezier.svg');
position: relative;
overflow: hidden;
}
}
}
/* Alpha banner for bezier button */
.alpha-banner {
position: absolute;
top: 6px;
right: -18px;
background: rgba(255, 255, 255, 0.4);
color: #000;
padding: 1px 20px;
font-size: 8px;
font-weight: 700;
transform: rotate(45deg);
transform-origin: center;
z-index: 10;
box-shadow: 0 1px 3px #0000004d;
line-height: 12px;
letter-spacing: 0.5px;
}
.alter-marker-wrapper .row.bottom-separator {
border-bottom: 1px dashed #fff;
}
.alter-marker-wrapper .row {
display: -webkit-box;
display: flex;
white-space: nowrap;
}
.alter-marker-wrapper .header {
padding-right: 4px;
width: 100%;
text-align: left;
}
.alter-marker-wrapper .area,
.alter-marker-wrapper .header {
font-size: 12px;
font-weight: 600;
line-height: 20px;
}
.alter-marker-wrapper .unit {
font-size: 11px;
font-weight: 400;
line-height: 20px;
}
.alter-marker-wrapper .unit .sup {
font-size: smaller;
font-weight: 400;
line-height: 20px;
position: relative;
top: -2px;
}
.leaflet-popup-content {
margin: 0 ;
line-height: 1.4;
}
.right-margin {
margin-right: 8px;
}
.info-marker-wrapper .row.bottom-separator {
border-bottom: 1px dashed #fff;
}
.info-marker-wrapper .row {
display: -webkit-box;
display: flex;
white-space: nowrap;
}
.info-marker-wrapper .header {
padding-right: 4px;
width: 100%;
text-align: left;
}
.info-marker-wrapper .area,
.info-marker-wrapper .header {
font-size: 12px;
font-weight: 600;
line-height: 20px;
}
.info-marker-wrapper .unit {
font-size: 11px;
font-weight: 400;
line-height: 20px;
}
.info-marker-wrapper .unit .sup {
font-size: smaller;
font-weight: 400;
line-height: 20px;
position: relative;
top: -2px;
}
.leaflet-popup-content {
margin: 0 ;
line-height: 1.4;
}
.right-margin {
margin-right: 8px;
}
/* Hidden marker styles */
.polydraw-hidden-marker {
opacity: 0.2;
transform: scale(0.5);
transition:
opacity 0.2s ease,
transform 0.2s ease;
background-color: #e0f8c5 ;
box-shadow: none ;
border: none ;
z-index: 1;
}
.polydraw-hidden-marker:hover {
opacity: 1 ;
transform: scale(1) ;
background-color: #e0f8c5 ;
box-shadow:
0 0 0 2px #50622b,
0 0 10px rgba(0, 0, 0, 0.35) ;
border-radius: 50% ;
z-index: 10000 ;
}
/* Ensure hidden markers are still draggable */
.polydraw-hidden-marker.leaflet-marker-draggable {
cursor: move ;
}
.leaflet-polydraw-p2p-marker {
margin-left: -8px;
margin-top: -8px;
}
.leaflet-polydraw-p2p-marker.edge-deletion-hover {
background-color: #d9460f ;
border-color: #d9460f ;
transform: scale(1.5);
transition: all 0.2s ease;
}
.menu-popup .leaflet-popup-tip-container,
.info-popup .leaflet-popup-tip-container {
display: none;
}
.menu-popup .leaflet-popup-content-wrapper,
.info-popup .leaflet-popup-content-wrapper {
background: transparent;
box-shadow: none;
}
.menu-popup .leaflet-popup-close-button,
.info-popup .leaflet-popup-close-button {
color: white ;
}
/* Firefox Android button fix - ensure draw mode buttons remain responsive */
.leaflet-control.leaflet-bar {
position: relative;
z-index: 1000;
pointer-events: auto ;
}
.leaflet-control.leaflet-bar a {
pointer-events: auto ;
touch-action: manipulation;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Firefox-specific fixes for touch event handling */
@-moz-document url-prefix() {
.leaflet-control.leaflet-bar {
position: relative ;
z-index: 2000 ;
pointer-events: auto ;
isolation: isolate;
}
.leaflet-control.leaflet-bar a {
pointer-events: auto ;
touch-action: manipulation ;
position: relative;
z-index: 1;
}
.sub-buttons {
pointer-events: auto ;
position: relative;
z-index: 1;
}
.sub-buttons a {
pointer-events: auto ;
touch-action: manipulation ;
position: relative;
z-index: 1;
}
}
/* Additional mobile-specific fixes */
@media (max-width: 768px) {
.leaflet-control.leaflet-bar a {
min-height: 44px;
min-width: 44px;
display: flex;
align-items: center;
justify-content: center;
}
}