Skip to content

Commit

Permalink
fix: offset option in globe center method now takes local frame orien…
Browse files Browse the repository at this point in the history
…tation into account
  • Loading branch information
claustres committed Jul 18, 2024
1 parent 0c0748b commit bb3e7f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion map/client/mixins/globe/mixin.base-globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Emitter from 'tiny-emitter'
import { getCssVar } from 'quasar'
import { Ion, Viewer, Color, viewerCesiumInspectorMixin, Rectangle, ScreenSpaceEventType, ScreenSpaceEventHandler, buildModuleUrl,
Cesium3DTileset, ImageryLayer, Cartesian3, PinBuilder, BoundingSphere, Ellipsoid, Cartographic, Entity, EntityCollection,
exportKml, VerticalOrigin, Math as CesiumMath } from 'cesium'
exportKml, VerticalOrigin, Transforms, Matrix3, Matrix4, Math as CesiumMath } from 'cesium'
import 'cesium/Source/Widgets/widgets.css'
import { Geolocation } from '../../geolocation.js'
import { Cesium, convertCesiumHandlerEvent, isTerrainLayer, convertEntitiesToGeoJson, createCesiumObject } from '../../utils.globe.js'
Expand Down Expand Up @@ -353,6 +353,9 @@ export const baseGlobe = {
const duration = _.get(options, 'duration', 0)
const destination = Cartesian3.fromDegrees(longitude, latitude, altitude || center.height)
const offset = new Cartesian3(_.get(options, 'offset.x', 0), _.get(options, 'offset.y', 0), _.get(options, 'offset.z', 0))
const rotation = new Matrix3()
Matrix4.getRotation(Transforms.eastNorthUpToFixedFrame(destination, Ellipsoid.WGS84), rotation)
Matrix3.multiplyByVector(rotation, offset, offset)
const target = {
destination: Cartesian3.add(destination, offset, destination),
orientation: {
Expand Down

0 comments on commit bb3e7f5

Please sign in to comment.