private void LoadFinish()
{
if (imageObject != null && imageObject.Is("img"))
{
if (Settings.DisplayType == 0)
{
imageObject.Height(height);
}
else if (Settings.DisplayType == 2)
{
imageObject.Width(width);
}
else
{
double widthFactor = width / imageElement.Width;
double heightFactor = height / imageElement.Height;
double factor = widthFactor < heightFactor ? widthFactor : heightFactor;
imageObject
.Width(Math.Round(imageElement.Width * factor))
.Height(Math.Round(imageElement.Height * factor));
}
}
else
{
imageObject = jQuery.FromHtml("<div></div>").Append(imagePart1Object).Append(imagePart2Object);
if (Settings.DisplayType == 0)
{
imagePart1Object.Height(height);
imagePart2Object.Height(height);
imageObject.Height(height).Width(imageElementPart1.Width / imageElementPart1.Height * height * 2);
}
else if (Settings.DisplayType == 2)
{
int halfWidth = Math.Round(width / 2);
imagePart1Object.Width(halfWidth);
imagePart2Object.Width(halfWidth);
imageObject.Width(halfWidth * 2);
}
else
{
double widthFactor = width / imageElementPart1.Width / 2;
double heightFactor = height / imageElementPart1.Height;
double factor = widthFactor < heightFactor ? widthFactor : heightFactor;
int halfWidth = Math.Round(imageElementPart1.Width * factor);
int sHeight = Math.Round(imageElementPart1.Height * factor);
imagePart1Object.Width(halfWidth).Height(sHeight);
imagePart2Object.Width(halfWidth).Height(sHeight);
imageObject.Width(halfWidth * 2).Height(sHeight);
}
}
loading = false;
loaded = true;
onload();
}