display:true solved it for the node, although I initially had tag
child in the node element in order to use GSS to control the outcome
but that doesn't work so I continued to play around with the hackish
way solution. I was able to create artificial nodes following the
edges of the image in order to activate the hover and mousedown
styles. This works almost everytime :) Sometimes the mouse needs to be
moved in and out of the area to activate the styles.
This is a hack but for those who follow this, here we go:
in Way.initialize it used to be
if (this.coastline) {
Coastline.coastlines.push(this)
} else {
Style.parse_styles(this,Style.styles.way)
Geohash.put_object(this)
}
now I changed the latter part of if...else to
var operator = [1,-1,1,-1]
var operator2= [1,1,-1,-1]
Style.parse_styles(this,Style.styles.way)
if (this.imageWidth != 'auto') {
if (this.nodes.length == 1) {
var firstNode = null
this.nodes.clear()
for (var i = 0; i < 4; i++) {
var n = new Node
n.h = 10
n.w = 10
n.color = Glop.random_color()
n.timestamp = new Date
n.id = Math.floor(Math.random() * 10000)
n.x = this.bbox[1] - operator[i] *
this.imageWidth/2;
n.y = this.bbox[0] - operator2[i] *
this.imageWidth/2;
n.lon = Projection.x_to_lon(n.x)
n.lat = Projection.y_to_lat(n.y)
this.nodes.push(n)
if (firstNode == null) firstNode = n;
}
this.nodes.push(firstNode)
if (this.nodes.length > 1 && this.nodes.first().x ==
this.nodes.last().x && this.nodes.first().y == this.nodes.last().y)
this.closed_poly = true
this.area = Geometry.poly_area(this.nodes)
this.bbox = Geometry.calculate_bounding_box(this.nodes)
this.width = Math.abs(Projection.x_to_lon(this.bbox[1])-
Projection.x_to_lon(this.bbox[3]))
this.height = Math.abs(Projection.y_to_lat(this.bbox[0])-
Projection.y_to_lat(this.bbox[2]))
}
}
Geohash.put_object(this)
so basicly if the way is a single node way, and there is an explicit
image size defined (the default is auto, perhaps one should actually
check for image, and if auto then check the real image size...), a new
values are calculated for the way based on the image boundaries, this
way the hover and mousedown work based on the image size.
Harri
On Jul 10, 11:07 pm, Jeffrey Warren <
j...@unterbahn.com> wrote:
> just fyi, if you go tohttp://
cartagen.org/utility/geocodeit generates
> correct JSON, and oddly it uses "visible:true" AND "display:true" -- so one
> of those or both are necessary. Egads.
>
> Example:
>
> {"osm":{"node":[{"lat":"42.1010549","lon":"-71.0212903","visible":"true","d isplay":true,"img":"image-url.png"}]}}