Author Topic: Is possible aligning a changing size image to the right border?  (Read 7625 times)

lnminente

  • Hero Member
  • *****
  • Posts: 1049
I'm writing an embedded TM and i would like to align the artist picture to the right, but that image should change its height to fit the bottom panel dynamically maintaining the aspect relation. So the x coordinate should decrease if the panel is taller, or decrease if we make the bottom panel shorter.

I have different codes with the following results:
At left border only if resizing bottom panel xAnchor="-Panel.Height" x="-10" y="10"
Shows at the left border xAnchor="-X:Panel.Height" x="0" y="10"
Shows at the left border xAnchor="X:-Panel.Height" x="0" y="10"
Shows at the left border xAnchor="X:Panel.Right-Panel.Height" x="0" y="0"
Shows at the left border xAnchor="X:Panel.Right-Y:Panel.Height" x="0" y="0"
Didn't shown anything xAnchor="Panel.Right" x="-Panel.Height" y="10"
It's something but not aligned to the right xAnchor="Panel.Right" x="-300" y="10"  

The album art is included aligned to the left border for comparison:

Code
<?xml version="1.0" encoding="utf-8"?>
<root>
<theaterMode>
  <settings enableScaling="false" />
  <settings rotationPeriod="300" />
  <settings bdr="128,128,128" bg="34,40,42" />
</theaterMode>

<!-- Album cover aligned to the left -->
<element type="AlbumCover" x="10" y="10" widthDock="Panel.Height" width="-20" heightDock="Panel" height="-20" min="100" max="400" brightness="1.0" ></element>

<!-- Artist picture would like to align it to the right
It's something xAnchor="Panel.Right" x="-300" y="10"  
At left border only if resizing bottom panel xAnchor="-Panel.Height" x="-10" y="10"
Shows at the left border xAnchor="-X:Panel.Height" x="0" y="10"
Shows at the left border xAnchor="X:-Panel.Height" x="0" y="10"
Shows at the left border xAnchor="X:Panel.Right-Panel.Height" x="0" y="0"
Shows at the left border xAnchor="X:Panel.Right-Y:Panel.Height" x="0" y="0"
Didn't shown anything xAnchor="Panel.Right" x="-Panel.Height" y="10"
-->
<element type="Gallery"
xAnchor="Panel.Right" x="-300" y="10"
widthDock="Panel.Height" width="-10" heightDock="Panel.Height" height="-10" min="100" max="300"
aspectRatio="zoomKeep" interval="20" tags="artist"
></element>

</root>

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31545
you can set the size to the panel height but i dont think there is a way in the current version to right align - this would left align the picture to the height of the panel
x="10" y="10" widthDock="Panel.Height" width="-20" heightDock="Panel" height="-20"

i will look at any enhancements next year

lnminente

  • Hero Member
  • *****
  • Posts: 1049
Thanks Steven, hope you have REALLY GOOD holidays in good company you really have won it

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31545
i have added support for basic expressions (+/-) in the x and y offset values eg. to right align a variable size picture:
Code
<element type="AlbumCover" xAnchor="Panel.Right" x="11-Panel.Height" y="9" widthDock="Panel.Height" width="-20" heightDock="Panel" height="-20" min="100" max="300" brightness="1.0" ></element>

also i have changed it so "enableScaling" is ignored for embeded theatermode skins because as implemented it causes positioning problems for aligning elements (I will leave it in for the normal theatermode skins incase the change causes older skins to not work plus its useful for resizing fonts)
Last Edit: January 01, 2013, 11:43:38 AM by Steven

lnminente

  • Hero Member
  • *****
  • Posts: 1049
I have updated my Narrow One with this new feature, but the panels with the width set to justify the left border of the right aligned image gets broken. Here is the TM using it: http://www.mediafire.com/?gna2pw460exdowz

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31545
looks fine to me - did you get the new mb_TheaterModePlugin.dll file?
perhaps you could post a screenshot

lnminente

  • Hero Member
  • *****
  • Posts: 1049
I have reupdated but the problem persists. It happens when pressing a button to switch the autohide panels and when resizing the height of the bottom panel. It ends like this:



-The righter picture dissapears, i think it's moved to the first pixel after the Panel.right. The central autohide panels should fit to its left border, now fit to the Panel.Right

-The buttons for autohide panels, move all to the same position.

Another problem is with the buttons for the autohide panel, they seem dependant on the width of the panel, but they are set with a fixed width from a top left corner in the xml file. If i reduce the width of the panel they don't show completely. Here a comparison of maximized windows versus a smaller one:

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31545
the general resizing/ hiding/ unhiding blocks issue should be resolved:
http://musicbee.niblseed.com/V2_1/MusicBee_Exe_Patched.zip

however with you right-aligned artist picture, the artist pictures themselves are generally not square so doesnt work well with the shading block you have with the artist picture. Let me know if you are interested to have the ability to show a square artist thumbnail from last.fm - a downside is they are only 126x126

lnminente

  • Hero Member
  • *****
  • Posts: 1049
If isn't much work i'm interested. I could put the name of the artist at the bottom of its image like in the album artwork and think it would save bandwitdh in 3G networks and would reduce cpu usage resizing some 1080 images.
If need anything write me here or PM me

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31545
to retrieve square artist pictures (from last.fm)
<element type="ArtistPicture" artistType="Artist" pictureSize="Square" ...

and another way to right-align pictures (which works better than the old way when you use the "max" attribute

<element type="ArtistPicture" artistType="Artist" xAnchor="Panel.Right" x="-10" align="Top.Right" y="3" widthDock="Panel.Height" heightDock="Panel" width="-10" height="-10"

http://musicbee.niblseed.com/V2_1/MusicBee_Exe_Patched.zip