Skip to content

Commit

Permalink
map-footer: show id of object and tile in hex
Browse files Browse the repository at this point in the history
  • Loading branch information
macabeus committed Jan 2, 2020
1 parent 83ee758 commit 6dde835
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion brush/src/components/Map/DrawingLayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ const DrawingLayer = ({

inspector: ({ x, y }) => {
const tileId = getTilemapPoint(x, y)
const hexTileId = `0x${tileId.toString(16).toUpperCase()}`
const tilemapPointInfos = {
message: `Tile ${fromSchemeGetTileNameById(scheme)(tileId)} (${tileId})`,
message: `Tile ${fromSchemeGetTileNameById(scheme)(tileId)} (${hexTileId})`,
x,
y,
}
Expand Down
11 changes: 6 additions & 5 deletions brush/src/components/Map/Point/PointObject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import { defaultTo, pipe } from 'ramda'
import { defaultTo } from 'ramda'
import { objectIdToName } from 'scissors'
import Point from '.'

Expand Down Expand Up @@ -32,11 +32,12 @@ const PointObject = ({
const name = defaultTo('unknown', objectIdToName[objectId])
const color = defaultTo([0x000000, 1], objectIdToColor[objectId])

const getInformations = () => ({
message: `Object ${name} (${objectId}) from stage ${stage}`,
const hexObjectId = `0x${objectId.toString(16).toUpperCase()}`
const informations = {
message: `Object ${name} (${hexObjectId}) from stage ${stage}`,
x,
y,
})
}

const saveNewObjectPosition = (newX, newY) => {
onFinishDragAndDrop(objectIndex, `xStage${stage}`, newX)
Expand All @@ -50,7 +51,7 @@ const PointObject = ({
draggable
hasStroke
onClickHandle={onClick}
onHoverHandle={pipe(getInformations, showPointInfosHandle)}
onHoverHandle={() => showPointInfosHandle(informations)}
onFinishDragAndDropHandle={saveNewObjectPosition}
scale={8}
x={x}
Expand Down

0 comments on commit 6dde835

Please sign in to comment.