Cannot display map labels anymore

All and any discussion and development of the Mudlet Mapper.
Post Reply
Aico
Posts: 27
Joined: Wed Jan 20, 2010 3:46 pm

Cannot display map labels anymore

Post by Aico »

I just pulled the lastest source upgrading from test4-final to fix the special exits problem. I have found that my labels no longer show on the map. Just to check for incompatible data, I created a new label on the map using the dialog based label creator from the mapper context menu. The label seems to have completed successfully when I retrieve the labels programmatically, but the new label does not show on the map. Is this a known issue?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cannot display map labels anymore

Post by Vadi »

Yes, the API for creating labels is now "stale", having been replaced internally by another option of drawing labels in the background, adding pictures to map labels (so you can have backgrounds on maps), and customizable text. The Lua API hasn't been updated for this yet and uses the old mechanism which isn't rendered by the mapper anymore.

A patch here: https://bugs.launchpad.net/mudlet/+bug/1008280 restores the functionality.

Aico
Posts: 27
Joined: Wed Jan 20, 2010 3:46 pm

Re: Cannot display map labels anymore

Post by Aico »

Thanks, that solved the problem. Look forward to using the new labels features you mentioned in the future.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Cannot display map labels anymore

Post by chris »

You might want to include the following as well, which will make the labels act their correct size with respect to mouse clicks:
Code: [show] | [select all] lua
//the later operations transform this, we need to untransform old labels
                mpMap->mapLabels[mAID][it.key()].size = QSizeF(br.width()/mTX, br.height()/mTY);
                _drawRect.setSize(br.size());//set drawrect to the new size for selecting
Put that right after:
lp.drawText( lr, Qt::AlignLeft, it.value().text, &br );

Aico
Posts: 27
Joined: Wed Jan 20, 2010 3:46 pm

Re: Cannot display map labels anymore

Post by Aico »

^Thanks.

A question though, do I have to make all he labels again when the new Label functionality comes out?

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Cannot display map labels anymore

Post by chris »

Your Old labels will be converted internally.

Post Reply