Skip to content

Commit

Permalink
[BUG] Rotation with ol@9+ #1075
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Jun 19, 2024
1 parent 4dce74c commit ee74915
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/style/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ol_style_Stroke from 'ol/style/Stroke.js'
import ol_style_Fill from 'ol/style/Fill.js'
import {asString as ol_color_asString} from 'ol/color.js'
import {ol_coordinate_dist2d} from '../geom/GeomUtils.js'
import { VERSION as ol_util_VERSION } from 'ol/util.js'

/** Profile style
* Draw a profile on the map
Expand Down Expand Up @@ -99,8 +100,8 @@ var ol_style_Profile = class olstyleProfile extends ol_style_Style {
_renderLine(geom, g, l, e) {
var i, p, ctx = e.context

var cos = Math.cos(e.rotation)
var sin = Math.sin(e.rotation)
var cos = parseInt(ol_util_VERSION) >= 9 ? 1 : Math.cos(e.rotation)
var sin = parseInt(ol_util_VERSION) >= 9 ? 0 : Math.sin(e.rotation)
// var a = e.pixelRatio / e.resolution;
var a = ol_coordinate_dist2d(geom[0], geom[1]) / ol_coordinate_dist2d(g[0], g[1])
var dx = geom[0][0] - g[0][0] * a * cos - g[0][1] * a * sin
Expand Down

0 comments on commit ee74915

Please sign in to comment.