Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added type option for vertical/horizontal controlbar #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions dist/leaflet.toolbar-src.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
border-right: 0;
text-align: center;
text-decoration: none;
background-color: #ffffff;
background-color: #fff;
}
.leaflet-toolbar-0 > li > .leaflet-toolbar-icon:hover {
background-color: #f4f4f4;
Expand All @@ -42,16 +42,14 @@
width: 16px;
height: 16px;
margin: -8px auto 0;
background-color: #ffffff;
background-color: #fff;
border: 2px solid rgba(0, 0, 0, 0.2);
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
background-clip: content-box;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
transform: rotate(45deg);
}
/* L.Toolbar.Control */
.leaflet-control-toolbar {
Expand Down Expand Up @@ -134,3 +132,32 @@
width: 30px;
height: 30px;
}
/* L.Toolbar.Control (Horizontal) */
.leaflet-control-toolbar-horizontal > li {
float: left;
}
.leaflet-control-toolbar-horizontal > li > .leaflet-toolbar-icon {
border-right: 1px solid #ccc;
}
.leaflet-control-toolbar-horizontal > li:first-child > .leaflet-toolbar-icon {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.leaflet-control-toolbar-horizontal > li:last-child > .leaflet-toolbar-icon {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-width: 0;
border-right: none;
}
.leaflet-control-toolbar-horizontal .leaflet-toolbar-1 {
position: absolute;
top: 30px;
left: 0;
padding-left: 0;
}
.leaflet-control-toolbar-horizontal .leaflet-toolbar-1 > li > .leaflet-toolbar-icon {
position: relative;
float: left;
width: 30px;
height: 30px;
}
12 changes: 10 additions & 2 deletions dist/leaflet.toolbar-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ window.L.Toolbar2 = (L.Layer || L.Class).extend({

options: {
className: '',
type: 'vertical', /* or 'horizontal' */
filter: function() { return true; },
actions: []
},
Expand Down Expand Up @@ -53,7 +54,13 @@ window.L.Toolbar2 = (L.Layer || L.Class).extend({
},

appendToContainer: function(container) {
var baseClass = this.constructor.baseClass + '-' + this._calculateDepth(),
var _baseClass;
if (this.options.type === 'horizontal' && this.constructor.baseClassH) {
_baseClass = this.constructor.baseClassH;
} else {
_baseClass = this.constructor.baseClass;
}
var baseClass = _baseClass + '-' + this._calculateDepth(),
className = baseClass + ' ' + this.options.className,
Action, action,
i, j, l, m;
Expand Down Expand Up @@ -249,7 +256,8 @@ L.Toolbar2.Action.extendOptions = function(options) {

L.Toolbar2.Control = L.Toolbar2.extend({
statics: {
baseClass: 'leaflet-control-toolbar ' + L.Toolbar2.baseClass
baseClass: 'leaflet-control-toolbar ' + L.Toolbar2.baseClass,
baseClassH: 'leaflet-control-toolbar-horizontal ' + L.Toolbar2.baseClass
},

initialize: function(options) {
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet.toolbar.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/leaflet.toolbar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading