HangTag = class(Object, function(o,x,y,value)
	Object.init(o, x, y, vgridSize, hgridSize)
	o.value = value
	o.sprite = sprites["hang_tag.png"]
	HangTag.setPosition(o, x, y);
end)

function HangTag:draw()
	self.left:draw()
	self.center:drawStretched()
	self.right:draw()
	self.beat:draw()
	self.valText:draw()
end
function HangTag:updatePrice(val)
	self.value = val
	self:setPosition(self.pos.x, self.pos.y)
end
function HangTag:setPosition(x, y)
	self.p = 18
	local sprBeat = sprites["tag_beat.png"]
	self.p = self.p* r_scale/2
	
	self.valText = StringObject(0,self.pos.y,self.value)
	self.valText:setColor(130,128,124)
	self.valText.layer = 4
	self.valText.scrollFactor = Vec2(0,0)
	self.text_w = math.ceil(math.max(30, self.valText.w+self.p*2+sprBeat:getWidth()))

	Rectangle.setPosition(self, x, y)
	local sprLeft = sprites["tag_left.png"]
	self.left = Object(x, y, sprLeft:getWidth(), sprLeft:getHeight())
	self.left.sprite = sprLeft
	self.left.scrollFactor = Vec2(0,0)
	self.left.layer = 4

	self.center = Object(math.floor(self.left.pos.x+self.left.w), self.left.pos.y, self.text_w, self.left.h)
	self.center.sprite = sprites["tag_middle.png"]
	self.center.scrollFactor = Vec2(0,0)
	self.center.layer = 4
	
	self.valText:setPosition(self.center.pos.x+self.p, math.floor(self.pos.y+self.p/2));

	self.beat = Object(math.floor(self.center.pos.x+self.center.w-sprBeat:getWidth()*1.33), math.floor(self.left.pos.y+self.left.h/2-sprBeat:getHeight()/3*2), sprBeat:getWidth(), sprBeat:getHeight())
	self.beat.sprite = sprBeat
	self.beat.scrollFactor = Vec2(0,0)
	self.beat.layer = 4

	local sprRight = sprites["tag_right.png"]
	self.right = Object(math.floor(self.center.pos.x+self.center.w)-1, self.left.pos.y, sprRight:getWidth(), self.left.h)
	
	-- self.value = tostring("rightside " .. self.right.pos.x .. ", " .. self.center.w .. ", " .. self.center.pos.x])

	self.right.scrollFactor = Vec2(0,0)
	self.right.sprite = sprRight
	self.right.layer = 4
	self.w = self.right.pos.x+self.right.w-self.pos.x

end