Skip to content

Commit 8251bf3

Browse files
committed
- Toevoegen symbool intercom op user-vraag
- nieuwe functie getSitPlanBoundaries voor Electro-items om de grenzen van de bounding box in het situatieplan scherper te kunnen zetten.
1 parent 8dd1946 commit 8251bf3

File tree

4 files changed

+131
-39
lines changed

4 files changed

+131
-39
lines changed

builddate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var CONF_builddate="20250116-222848"
1+
var CONF_builddate="20250119-131821"

eendraadschema.js

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
3333
function verb(n) { return function (v) { return step([n, v]); }; }
3434
function step(op) {
3535
if (f) throw new TypeError("Generator is already executing.");
36-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
36+
while (_) try {
3737
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3838
if (y = 0, t) op = [op[0] & 2, t.value];
3939
switch (op[0]) {
@@ -3904,6 +3904,14 @@ var Electro_Item = /** @class */ (function (_super) {
39043904
//this.updateSituationPlanElement(myElement); //Lijkt niet nodig aangezien dit zoiezo gebeurt in getScaledSVG bij iedere update
39053905
return (myElement);
39063906
};
3907+
Electro_Item.prototype.getSitPlanBoundaries = function () {
3908+
return {
3909+
clipleft: 12,
3910+
addright: 0,
3911+
cliptop: 0,
3912+
addbottom: 0
3913+
};
3914+
};
39073915
Electro_Item.prototype.updateSituationPlanElement = function (myElement) {
39083916
var spiegeltext = false;
39093917
var rotate = myElement.rotate % 360;
@@ -3913,18 +3921,17 @@ var Electro_Item = /** @class */ (function (_super) {
39133921
var mySVGElement = this.toSVG(true, spiegeltext);
39143922
var sizex = mySVGElement.xright + mySVGElement.xleft + 10;
39153923
var sizey = mySVGElement.yup + mySVGElement.ydown;
3916-
var clipleft = 0;
3917-
if (['Contactdoos', 'Bel'].includes(this.getType())) {
3918-
clipleft = 0;
3919-
}
3920-
else {
3921-
clipleft = 12;
3924+
var boundaries = this.getSitPlanBoundaries();
3925+
switch (this.getType()) {
3926+
case 'Contactdoos':
3927+
case 'Bel':
3928+
boundaries.clipleft = 0;
3929+
break;
39223930
}
3923-
var addright = 0;
3924-
var width = sizex - clipleft + addright;
3925-
var height = sizey;
3931+
var width = sizex - boundaries.clipleft + boundaries.addright;
3932+
var height = sizey - boundaries.cliptop + boundaries.addbottom;
39263933
myElement.updateElectroItemSVG('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" transform="scale(1,1)" ' +
3927-
"viewBox=\"".concat(clipleft, " 0 ").concat(sizex - clipleft, " ").concat(sizey, "\" width=\"").concat(width, "\" height=\"").concat(height, "\">") +
3934+
"viewBox=\"".concat(boundaries.clipleft, " ").concat(boundaries.cliptop, " ").concat(sizex - boundaries.clipleft + boundaries.addright, " ").concat(sizey - boundaries.cliptop + boundaries.addbottom, "\" width=\"").concat(width, "\" height=\"").concat(height, "\">") +
39283935
SVGSymbols.getNeededSymbols() + // enkel de symbolen die nodig zijn voor dit element
39293936
mySVGElement.data +
39303937
'</svg>', width, height);
@@ -6827,7 +6834,7 @@ var Media = /** @class */ (function (_super) {
68276834
this.props.symbool = "";
68286835
};
68296836
Media.prototype.overrideKeys = function () {
6830-
if (this.props.symbool == 'luidspreker') {
6837+
if (['luidspreker', 'intercom'].includes(this.props.symbool)) {
68316838
if (this.props.aantal < 1)
68326839
this.props.aantal = 1;
68336840
if (this.props.aantal > 20)
@@ -6841,8 +6848,8 @@ var Media = /** @class */ (function (_super) {
68416848
this.overrideKeys();
68426849
var output = this.toHTMLHeader(mode);
68436850
output += "&nbsp;" + this.nrToHtml()
6844-
+ "Symbool: " + this.selectPropToHTML('symbool', ["", "luidspreker"]);
6845-
if (this.props.symbool == 'luidspreker') {
6851+
+ "Symbool: " + this.selectPropToHTML('symbool', ["", "luidspreker", "intercom"]);
6852+
if (['luidspreker', 'intercom'].includes(this.props.symbool)) {
68466853
output += ", Aantal: " + this.selectPropToHTML('aantal', ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"]);
68476854
}
68486855
output += ", Adres/tekst: " + this.stringPropToHTML('adres', 5);
@@ -6854,28 +6861,66 @@ var Media = /** @class */ (function (_super) {
68546861
SVGSymbols.addSymbol('luidspreker');
68556862
// Alles naar beneden schuiven als we het aantal laders boven het symbool willen plaatsen
68566863
var shifty = 0;
6857-
if (this.props.aantal > 1) {
6858-
shifty = 15;
6859-
mySVG.data += '<text x="31" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>';
6864+
if ((this.props.aantal > 1) && (!sitplan) && (['luidspreker', 'intercom'].includes(this.props.symbool))) {
6865+
switch (this.props.symbool) {
6866+
case "luidspreker":
6867+
shifty = 15;
6868+
mySVG.data += '<text x="31" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>';
6869+
break;
6870+
case "intercom":
6871+
shifty = 5;
6872+
mySVG.data += '<text x="36" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>';
6873+
break;
6874+
}
68606875
}
68616876
mySVG.xleft = 1; // foresee at least some space for the conductor
68626877
mySVG.xright = 59;
68636878
mySVG.yup = 25 + shifty;
68646879
mySVG.ydown = 25;
68656880
switch (this.props.symbool) {
68666881
case "luidspreker":
6867-
mySVG.data += (sitplan ? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black"></line>');
6868-
mySVG.data += '<use xlink:href="#luidspreker" x="21" y="' + (25 + shifty) + '"></use>';
6882+
mySVG.data += (sitplan ? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black" />');
6883+
mySVG.data += '<use xlink:href="#luidspreker" x="21" y="' + (25 + shifty) + '" />';
68696884
mySVG.xright = 36;
68706885
mySVG.data += (sitplan ? '' : this.addAddressToSVG(mySVG, 60 + shifty, 15, 0));
68716886
break;
6887+
case "intercom":
6888+
mySVG.data += (sitplan ? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black" />');
6889+
mySVG.data += "<rect x=\"21\" y=\"".concat((15 + shifty), "\" width=\"30\" height=\"20\" stroke=\"black\" fill=\"none\" />");
6890+
mySVG.data += "<rect x=\"36\" y=\"".concat((20 + shifty), "\" width=\"4\" height=\"10\" stroke=\"black\" fill=\"none\" />");
6891+
mySVG.data += "<line x1=\"40\" y1=\"".concat((20 + shifty), "\" x2=\"51\" y2=\"").concat((15 + shifty), "\" stroke=\"black\" />");
6892+
mySVG.data += "<line x1=\"40\" y1=\"".concat((30 + shifty), "\" x2=\"51\" y2=\"").concat((35 + shifty), "\" stroke=\"black\" />");
6893+
mySVG.data += "<line x1=\"46\" y1=\"".concat((25 + shifty), "\" x2=\"56\" y2=\"").concat((25 + shifty), "\" stroke=\"black\" stroke-width=\"2\" />");
6894+
mySVG.data += "<line x1=\"46\" y1=\"".concat((25 + shifty), "\" x2=\"48\" y2=\"").concat((23 + shifty), "\" stroke=\"black\" stroke-width=\"1\" stroke-linecap=\"round\" />");
6895+
mySVG.data += "<line x1=\"46\" y1=\"".concat((25 + shifty), "\" x2=\"48\" y2=\"").concat((27 + shifty), "\" stroke=\"black\" stroke-width=\"1\" stroke-linecap=\"round\" />");
6896+
mySVG.data += "<line x1=\"56\" y1=\"".concat((25 + shifty), "\" x2=\"54\" y2=\"").concat((23 + shifty), "\" stroke=\"black\" stroke-width=\"1\" stroke-linecap=\"round\" />");
6897+
mySVG.data += "<line x1=\"56\" y1=\"".concat((25 + shifty), "\" x2=\"54\" y2=\"").concat((27 + shifty), "\" stroke=\"black\" stroke-width=\"1\" stroke-linecap=\"round\" />");
6898+
mySVG.xright = 54;
6899+
mySVG.data += (sitplan ? '' : this.addAddressToSVG(mySVG, 50 + shifty, 5, -3));
6900+
break;
68726901
default:
68736902
mySVG.data += (sitplan ? '' : '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>');
68746903
mySVG.xright = 19;
68756904
break;
68766905
}
68776906
return (mySVG);
68786907
};
6908+
Media.prototype.getSitPlanBoundaries = function () {
6909+
var clipleft = 12;
6910+
var addright = 0;
6911+
var cliptop = 0;
6912+
var addbottom = 0;
6913+
switch (this.props.symbool) {
6914+
case 'luidspreker':
6915+
break;
6916+
case 'intercom':
6917+
addright = -5;
6918+
cliptop = 5;
6919+
addbottom = -5;
6920+
break;
6921+
}
6922+
return ({ clipleft: clipleft, addright: addright, cliptop: cliptop, addbottom: addbottom });
6923+
};
68796924
return Media;
68806925
}(Electro_Item));
68816926
var Meerdere_verbruikers = /** @class */ (function (_super) {

src/List_Item/Electro_Item.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ class Electro_Item extends List_Item {
250250
return(myElement);
251251
}
252252

253+
getSitPlanBoundaries() {
254+
return {
255+
clipleft: 12,
256+
addright: 0,
257+
cliptop: 0,
258+
addbottom: 0
259+
}
260+
}
261+
253262
updateSituationPlanElement(myElement: SituationPlanElement) {
254263

255264
let spiegeltext = false;
@@ -262,20 +271,19 @@ class Electro_Item extends List_Item {
262271
let sizex = mySVGElement.xright + mySVGElement.xleft + 10;
263272
let sizey = mySVGElement.yup + mySVGElement.ydown;
264273

265-
let clipleft = 0;
266-
if (['Contactdoos','Bel'].includes(this.getType())) {
267-
clipleft = 0;
268-
} else {
269-
clipleft = 12;
274+
let boundaries = this.getSitPlanBoundaries();
275+
276+
switch (this.getType()) {
277+
case 'Contactdoos': case 'Bel':
278+
boundaries.clipleft = 0;
279+
break;
270280
}
271281

272-
let addright = 0;
273-
274-
let width = sizex-clipleft+addright;
275-
let height = sizey;
282+
let width = sizex-boundaries.clipleft+boundaries.addright;
283+
let height = sizey-boundaries.cliptop+boundaries.addbottom;
276284

277285
myElement.updateElectroItemSVG( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" transform="scale(1,1)" ' +
278-
`viewBox="${clipleft} 0 ${sizex-clipleft} ${sizey}" width="${width}" height="${height}">` +
286+
`viewBox="${boundaries.clipleft} ${boundaries.cliptop} ${sizex-boundaries.clipleft+boundaries.addright} ${sizey-boundaries.cliptop+boundaries.addbottom}" width="${width}" height="${height}">` +
279287
SVGSymbols.getNeededSymbols() + // enkel de symbolen die nodig zijn voor dit element
280288
mySVGElement.data +
281289
'</svg>',width,height);

src/List_Item/Media.ts

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Media extends Electro_Item {
1313
}
1414

1515
overrideKeys() {
16-
if (this.props.symbool == 'luidspreker') {
16+
if (['luidspreker','intercom'].includes(this.props.symbool)) {
1717
if (this.props.aantal < 1) this.props.aantal = 1;
1818
if (this.props.aantal > 20) this.props.aantal = 20;
1919
} else {
@@ -26,9 +26,9 @@ class Media extends Electro_Item {
2626
let output = this.toHTMLHeader(mode);
2727

2828
output += "&nbsp;" + this.nrToHtml()
29-
+ "Symbool: " + this.selectPropToHTML('symbool',["","luidspreker"]);
29+
+ "Symbool: " + this.selectPropToHTML('symbool',["","luidspreker","intercom"]);
3030

31-
if (this.props.symbool == 'luidspreker') {
31+
if (['luidspreker','intercom'].includes(this.props.symbool)) {
3232
output += ", Aantal: " + this.selectPropToHTML('aantal',["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]);
3333
}
3434

@@ -43,10 +43,19 @@ class Media extends Electro_Item {
4343
SVGSymbols.addSymbol('luidspreker');
4444

4545
// Alles naar beneden schuiven als we het aantal laders boven het symbool willen plaatsen
46-
var shifty = 0;
47-
if (this.props.aantal>1) {
48-
shifty = 15;
49-
mySVG.data += '<text x="31" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>'
46+
let shifty = 0;
47+
if ((this.props.aantal>1) && (!sitplan) && (['luidspreker','intercom'].includes(this.props.symbool))) {
48+
switch (this.props.symbool) {
49+
case "luidspreker":
50+
shifty = 15;
51+
mySVG.data += '<text x="31" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>'
52+
break;
53+
case "intercom":
54+
shifty = 5;
55+
mySVG.data += '<text x="36" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>'
56+
break;
57+
}
58+
5059
}
5160

5261
mySVG.xleft = 1; // foresee at least some space for the conductor
@@ -56,11 +65,25 @@ class Media extends Electro_Item {
5665

5766
switch (this.props.symbool) {
5867
case "luidspreker":
59-
mySVG.data += (sitplan? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black"></line>');
60-
mySVG.data += '<use xlink:href="#luidspreker" x="21" y="' + (25 + shifty) + '"></use>';
68+
mySVG.data += (sitplan? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black" />');
69+
mySVG.data += '<use xlink:href="#luidspreker" x="21" y="' + (25 + shifty) + '" />';
6170
mySVG.xright = 36;
6271
mySVG.data += (sitplan? '' : this.addAddressToSVG(mySVG,60 + shifty,15,0));
6372
break;
73+
case "intercom":
74+
mySVG.data += (sitplan? '' : '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black" />');
75+
mySVG.data += `<rect x="21" y="${(15 + shifty)}" width="30" height="20" stroke="black" fill="none" />`;
76+
mySVG.data += `<rect x="36" y="${(20 + shifty)}" width="4" height="10" stroke="black" fill="none" />`;
77+
mySVG.data += `<line x1="40" y1="${(20 + shifty)}" x2="51" y2="${(15 + shifty)}" stroke="black" />`;
78+
mySVG.data += `<line x1="40" y1="${(30 + shifty)}" x2="51" y2="${(35 + shifty)}" stroke="black" />`;
79+
mySVG.data += `<line x1="46" y1="${(25 + shifty)}" x2="56" y2="${(25 + shifty)}" stroke="black" stroke-width="2" />`;
80+
mySVG.data += `<line x1="46" y1="${(25 + shifty)}" x2="48" y2="${(23 + shifty)}" stroke="black" stroke-width="1" stroke-linecap="round" />`;
81+
mySVG.data += `<line x1="46" y1="${(25 + shifty)}" x2="48" y2="${(27 + shifty)}" stroke="black" stroke-width="1" stroke-linecap="round" />`;
82+
mySVG.data += `<line x1="56" y1="${(25 + shifty)}" x2="54" y2="${(23 + shifty)}" stroke="black" stroke-width="1" stroke-linecap="round" />`;
83+
mySVG.data += `<line x1="56" y1="${(25 + shifty)}" x2="54" y2="${(27 + shifty)}" stroke="black" stroke-width="1" stroke-linecap="round" />`;
84+
mySVG.xright = 54;
85+
mySVG.data += (sitplan? '' : this.addAddressToSVG(mySVG,50 + shifty,5,-3));
86+
break;
6487
default:
6588
mySVG.data += (sitplan? '' : '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>');
6689
mySVG.xright = 19;
@@ -70,4 +93,20 @@ class Media extends Electro_Item {
7093
return(mySVG);
7194
}
7295

96+
getSitPlanBoundaries() {
97+
let clipleft = 12;
98+
let addright = 0;
99+
let cliptop = 0;
100+
let addbottom = 0;
101+
switch (this.props.symbool) {
102+
case 'luidspreker':
103+
break;
104+
case 'intercom':
105+
addright = -5;
106+
cliptop = 5;
107+
addbottom = -5;
108+
break;
109+
}
110+
return({clipleft: clipleft, addright: addright, cliptop: cliptop, addbottom: addbottom});
111+
}
73112
}

0 commit comments

Comments
 (0)