MCPcopy Create free account
hub / github.com/codecombat/codecombat / adjustLevelInfoPosition

Method adjustLevelInfoPosition

app/views/play/CampaignView.js:2013–2028  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

2011 }
2012
2013 adjustLevelInfoPosition (e) {
2014 if (!this.$levelInfo) { return }
2015 this.$map = this.$map ?? this.$el.find('.map')
2016 const mapOffset = this.$map.offset()
2017 const mapX = e.pageX - mapOffset.left
2018 const mapY = e.pageY - mapOffset.top
2019 const margin = 20
2020 const width = this.$levelInfo.outerWidth()
2021 const left = Math.min(Math.max(margin, mapX - (width / 2)), this.$map.width() - width - margin)
2022 this.$levelInfo.css('left', left)
2023 let top = mapY - this.$levelInfo.outerHeight() - 60
2024 if (top < 100) {
2025 top = mapY + 60
2026 }
2027 this.$levelInfo.css('top', top)
2028 }
2029
2030 onWindowResize (e) {
2031 if (!this.campaign) {

Callers 1

onClickLevelMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected