Erweiterungen
This commit is contained in:
@@ -166,15 +166,29 @@ window.initProfileInvoiceGenerator = function() {
|
||||
ctx.lineTo(x + w, y);
|
||||
ctx.stroke();
|
||||
} else if (el.type === 'image') {
|
||||
ctx.fillStyle = '#f0f0f0';
|
||||
ctx.fillRect(x, y, w, h);
|
||||
ctx.strokeStyle = '#999999';
|
||||
ctx.strokeRect(x, y, w, h);
|
||||
ctx.fillStyle = '#666666';
|
||||
ctx.font = Math.max(8, 12 * zoomFactor) + 'px Arial';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.fillText('Bild', x + w / 2, y + h / 2);
|
||||
if (el.imageData) {
|
||||
// Draw the uploaded image
|
||||
var img = new Image();
|
||||
img.onload = function() {
|
||||
ctx.drawImage(img, x, y, w, h);
|
||||
// Redraw selection if this element is selected
|
||||
if (selectedElement && selectedElement.id === el.id) {
|
||||
drawSelection(el);
|
||||
}
|
||||
};
|
||||
img.src = el.imageData;
|
||||
} else {
|
||||
// Draw placeholder
|
||||
ctx.fillStyle = '#f0f0f0';
|
||||
ctx.fillRect(x, y, w, h);
|
||||
ctx.strokeStyle = '#999999';
|
||||
ctx.strokeRect(x, y, w, h);
|
||||
ctx.fillStyle = '#666666';
|
||||
ctx.font = Math.max(8, 12 * zoomFactor) + 'px Arial';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.fillText('Bild', x + w / 2, y + h / 2);
|
||||
}
|
||||
} else {
|
||||
// Text elements
|
||||
ctx.font = (el.fontStyle || '') + ' ' + fontSize + 'px Arial';
|
||||
@@ -567,6 +581,15 @@ window.initProfileInvoiceGenerator = function() {
|
||||
}
|
||||
};
|
||||
|
||||
window.updateProfileElementImage = function(id, imageData) {
|
||||
var el = elements.find(function(e) { return e.id === id; });
|
||||
if (el) {
|
||||
el.imageData = imageData;
|
||||
el.text = 'Bild';
|
||||
draw();
|
||||
}
|
||||
};
|
||||
|
||||
window.deleteProfileElement = function(id) {
|
||||
var index = elements.findIndex(function(e) { return e.id === id; });
|
||||
if (index > -1) {
|
||||
|
||||
Reference in New Issue
Block a user