Skip to content

Commit

Permalink
[UPD] Inconsistent naming of profiles #1042
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Mar 22, 2024
1 parent ff263ab commit 1c1b8fe
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 59 deletions.
56 changes: 28 additions & 28 deletions src/control/Profil.css → src/control/Profile.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.ol-profil {
.ol-profile {
position: relative;
user-select: none;
}
.ol-control.ol-profil {
.ol-control.ol-profile {
position: absolute;
top: 0.5em;
right: 3em;
text-align: right;
overflow: hidden;
}
.ol-profil .ol-zoom-out {
.ol-profile .ol-zoom-out {
position: absolute;
top: 10px;
right: 10px;
Expand All @@ -20,7 +20,7 @@
border-radius: 2px;
cursor: pointer;
}
.ol-profil .ol-zoom-out:before {
.ol-profile .ol-zoom-out:before {
content: '';
height: 2px;
width: 60%;
Expand All @@ -31,30 +31,30 @@
transform: translate(-50%, -50%);
}

.ol-profil .ol-inner {
.ol-profile .ol-inner {
position: relative;
padding: 0.5em;
font-size: 0.8em;
}
.ol-control.ol-profil .ol-inner {
.ol-control.ol-profile .ol-inner {
display: block;
background-color: rgba(255,255,255,0.7);
margin: 2.3em 2px 2px;
}
.ol-control.ol-profil.ol-collapsed .ol-inner {
.ol-control.ol-profile.ol-collapsed .ol-inner {
display: none;
}

.ol-profil canvas {
.ol-profile canvas {
display: block;
}
.ol-profil button {
.ol-profile button {
display: block;
position: absolute;
right: 0;
overflow: hidden;
}
.ol-profil button i {
.ol-profile button i {
position: absolute;
left: 50%;
top: 50%;
Expand All @@ -63,8 +63,8 @@
height: 1em;
overflow: hidden;
}
.ol-profil button i:before,
.ol-profil button i:after {
.ol-profile button i:before,
.ol-profile button i:after {
content: "";
position: absolute;
display: block;
Expand All @@ -73,44 +73,44 @@
height: .9em;
transform: scaleX(.8) translate(-.25em, .5em) rotate(45deg);
}
.ol-profil button i:after {
.ol-profile button i:after {
transform: scaleX(.8) translate(.35em, .7em) rotate(45deg);
}

.ol-profil.ol-collapsed button {
.ol-profile.ol-collapsed button {
position: static;
}

.ol-profil .ol-profilbar,
.ol-profil .ol-profilcursor {
.ol-profile .ol-profilbar,
.ol-profile .ol-profilcursor {
position:absolute;
pointer-events: none;
width: 1px;
display: none;
}
.ol-profil .ol-profilcursor {
.ol-profile .ol-profilcursor {
width: 0;
height: 0;
}
.ol-profil .ol-profilcursor:before {
.ol-profile .ol-profilcursor:before {
content:"";
pointer-events: none;
display: block;
margin: -2px;
width:5px;
height:5px;
}
.ol-profil .ol-profilbar,
.ol-profil .ol-profilcursor:before {
.ol-profile .ol-profilbar,
.ol-profile .ol-profilcursor:before {
background: red;
}

.ol-profil table {
.ol-profile table {
text-align: center;
width: 100%;
}

.ol-profil table span {
.ol-profile table span {
display: block;
}

Expand All @@ -127,24 +127,24 @@
}


.ol-profil table td {
.ol-profile table td {
padding: 0 2px;
}

.ol-profil table .track-info {
.ol-profile table .track-info {
display: table-row;
}
.ol-profil table .point-info {
.ol-profile table .point-info {
display: none;
}
.ol-profil .over table .track-info {
.ol-profile .over table .track-info {
display: none;
}
.ol-profil .over table .point-info {
.ol-profile .over table .point-info {
display: table-row;
}

.ol-profil p {
.ol-profile p {
text-align: center;
margin:0;
}
48 changes: 17 additions & 31 deletions src/control/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {ol_coordinate_dist2d} from "../geom/GeomUtils.js";
import ol_ext_element from '../util/element.js'

/**
* @classdesc OpenLayers 3 Profil Control.
* @classdesc OpenLayers 3 Profile Control.
* Draw a profile of a feature (with a 3D geometry)
*
* @constructor
Expand All @@ -34,14 +34,14 @@ import ol_ext_element from '../util/element.js'
* @param {Object=} options
* @param {string} options.className
* @param {String} options.title button title
* @param {ol.style.Style} [options.style] style to draw the profil, default darkblue
* @param {ol.style.Style} [options.style] style to draw the profile, default darkblue
* @param {ol.style.Style} [options.selectStyle] style for selection, default darkblue fill
* @param {*} options.info keys/values for i19n
* @param {number} [options.width=300]
* @param {number} [options.height=150]
* @param {ol.Feature} [options.feature] the feature to draw profil
* @param {boolean} [options.selectable=false] enable selection on the profil, default false
* @param {boolean} [options.zoomable=false] can zoom in the profil
* @param {ol.Feature} [options.feature] the feature to draw profile
* @param {boolean} [options.selectable=false] enable selection on the profile, default false
* @param {boolean} [options.zoomable=false] can zoom in the profile
*/
var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
constructor(options) {
Expand All @@ -57,9 +57,9 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
var self = this
this.info = options.info || ol_control_Profil.prototype.info
if (options.target) {
element.classList.add(options.className || 'ol-profil')
element.classList.add(options.className || 'ol-profile')
} else {
element.className = ((options.className || 'ol-profil') + ' ol-unselectable ol-control ol-collapsed').trim()
element.className = ((options.className || 'ol-profile') + ' ol-unselectable ol-control ol-collapsed').trim()
this.button = document.createElement('button')
this.button.title = options.title || 'Profile';
this.button.setAttribute('type', 'button')
Expand Down Expand Up @@ -241,7 +241,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
popup(info) {
this.popup_.innerHTML = info
}
/** Show point on profil
/** Show point on profile
* @param {*} p
* @param {number} dx
* @private
Expand All @@ -268,7 +268,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
this.bar_.parentElement.classList.remove("over")
}
}
/** Show point at coordinate or a distance on the profil
/** Show point at coordinate or a distance on the profile
* @param { ol.coordinates|number } where a coordinate or a distance from begining, if none it will hide the point
* @return { ol.coordinates } current point
*/
Expand Down Expand Up @@ -303,7 +303,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
}
return null
}
/** Show point at a time on the profil
/** Show point at a time on the profile
* @param { Date|number } time a Date or a DateTime (in s) to show the profile on, if none it will hide the point
* @param { booelan } delta true if time is a delta from the start, default false
* @return { ol.coordinates } current point
Expand Down Expand Up @@ -335,7 +335,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
}
return null
}
/** Get the point at a given time on the profil
/** Get the point at a given time on the profile
* @param { number } time time at which to show the point
* @return { ol.coordinates } current point
*/
Expand Down Expand Up @@ -525,7 +525,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
}
}
/**
* Set the geometry to draw the profil.
* Set the geometry to draw the profile.
* @param {ol.Feature|ol.geom.Geometry} f the feature.
* @param {Object=} options
* @param {ol.ProjectionLike} [options.projection] feature projection, default projection of the map
Expand Down Expand Up @@ -613,7 +613,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {

this.refresh()
}
/** Refresh the profil
/** Refresh the profile
*/
refresh() {
var canvas = this.canvas_
Expand All @@ -632,7 +632,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {
var i

if (!d) {
console.error('[ol/control/Profil] no data...', t)
console.error('[ol/control/Profile] no data...', t)
return
}

Expand Down Expand Up @@ -778,7 +778,7 @@ var ol_control_Profil = class olcontrolProfil extends ol_control_Control {

ctx.stroke()
}
/** Get profil image
/** Get profile image
* @param {string|undefined} type image format or 'canvas' to get the canvas image, default image/png.
* @param {Number|undefined} encoderOptions between 0 and 1 indicating image quality image/jpeg or image/webp, default 0.92.
* @return {string} requested data uri
Expand Down Expand Up @@ -807,19 +807,5 @@ ol_control_Profil.prototype.info = {
"distanceUnitsKM": "km",
};
















export default ol_control_Profil
var ol_control_Profile = ol_control_Profil
export default ol_control_Profile

0 comments on commit 1c1b8fe

Please sign in to comment.