OpenCCM PlugIn für Xinha

Vorschau funktioniert nun auch. (#1206)

git-svn-id: https://svn.libreccm.org/ccm/trunk@1816 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2012-08-10 14:48:41 +00:00
parent c25dc4fb59
commit b5a3906a11
2 changed files with 17 additions and 11 deletions

View File

@ -111,7 +111,7 @@
--> -->
<input type="hidden" name="[src]" id="[src]"/> <input type="hidden" name="[src]" id="[src]"/>
<fieldset> <fieldset id="[layout]">
<legend> <legend>
<l10n>Layout</l10n> <l10n>Layout</l10n>
</legend> </legend>
@ -146,7 +146,7 @@
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset id="[dimensions]">
<legend> <legend>
<l10n>Dimension</l10n> <l10n>Dimension</l10n>
</legend> </legend>

View File

@ -87,14 +87,7 @@ OpenCCM.prototype.prepareImageDialog = function()
// OnResize // OnResize
this.dialogs["images"].onresize = function () this.dialogs["images"].onresize = function ()
{ {
var newHeightForPreview = self.resizePreview(this);
parseInt(this.height, 10)
// - this.getElementById("h1").offsetHeight
// - this.getElementById("buttons").offsetHeight
// - this.getElementById("inputs").offsetHeight
- parseInt(this.rootElem.style.paddingBottom, 10);
this.getElementById("preview").style.height = ((newHeightForPreview > 0) ? newHeightForPreview : 0) + "px";
this.getElementById("preview").style.width = "98%";
}; };
this.imageDialogReady = true; this.imageDialogReady = true;
@ -299,19 +292,32 @@ OpenCCM.prototype.imageBrowse = function(window)
OpenCCM.prototype.imageSet = function(imageData) OpenCCM.prototype.imageSet = function(imageData)
{ {
var dialog = this.dialogs["images"]; var dialog = this.dialogs["images"]
dialog.getElementById(dialog.id["src"]).value = imageData.src; dialog.getElementById(dialog.id["src"]).value = imageData.src;
dialog.getElementById(dialog.id["ipreview"]).src = imageData.src; dialog.getElementById(dialog.id["ipreview"]).src = imageData.src;
dialog.getElementById(dialog.id["width"]).value = imageData.width; dialog.getElementById(dialog.id["width"]).value = imageData.width;
dialog.getElementById(dialog.id["height"]).value = imageData.height; dialog.getElementById(dialog.id["height"]).value = imageData.height;
dialog.getElementById(dialog.id["name"]).value = imageData.name; dialog.getElementById(dialog.id["name"]).value = imageData.name;
dialog.getElementById(dialog.id["aspect"]).value = dialog.getElementById(dialog.id["width"]).value / dialog.getElementById(dialog.id["height"]).value; dialog.getElementById(dialog.id["aspect"]).value = dialog.getElementById(dialog.id["width"]).value / dialog.getElementById(dialog.id["height"]).value;
this.resizePreview(dialog);
if(imageData.src != "") if(imageData.src != "")
{ {
dialog.getElementById(dialog.id["preview"]).style.display = "block"; dialog.getElementById(dialog.id["preview"]).style.display = "block";
} else {
dialog.getElementById(dialog.id["preview"]).style.display = "none";
} }
}; };
OpenCCM.prototype.resizePreview = function(dialog) {
var aspect = dialog.getElementById(dialog.id["aspect"]).value;
var previewWidth = dialog.width - 22;
dialog.getElementById(dialog.id["ipreview"]).style.height = Math.round(previewWidth / aspect) + "px";
dialog.getElementById(dialog.id["ipreview"]).style.width = previewWidth + "px";
};
OpenCCM.prototype.calcWidth = function() OpenCCM.prototype.calcWidth = function()
{ {
var dialog = this.dialogs["images"]; var dialog = this.dialogs["images"];