Skip to content

Commit abb6706

Browse files
committed
Use width 7 for custom 3D marker (#205)
Previous width 4 was too small to see it properly with default settings
1 parent fe8f6d2 commit abb6706

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
12. Support custom mouse click/dblcklick handlers for lego plots
1616
13. Implement marker styles 35 - 49
1717
14. Let switch orthographic camera in geometry via control gui (#217)
18+
15. Fix drawing of custom markers on 3D (#205)
1819

1920

2021
## Changes in 6.1.1

scripts/JSRoot.base3d.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,30 +1326,28 @@ JSROOT.define(['d3', 'threejs_jsroot', 'painter'], (d3, THREE, jsrp) => {
13261326
// special dots
13271327
if (!args.style) k = 1.1; else
13281328
if (args.style === 1) k = 0.3; else
1329-
if (args.style === 2) args.style = 3; else // just avoid plot of "+" sign, issue #205
13301329
if (args.style === 6) k = 0.5; else
13311330
if (args.style === 7) k = 0.7;
13321331

13331332
let material;
13341333

1335-
if (!args.style || (k !== 1) || JSROOT.nodejs) {
1334+
if ((k !== 1) || JSROOT.nodejs) {
13361335
// this is plain creation of points, no texture loading, which does not work in node.js
13371336
material = new THREE.PointsMaterial({ size: (this.webgl ? 3 : 1) * this.scale * k, color: args.color });
13381337

13391338
} else {
13401339

1341-
let handler = new JSROOT.TAttMarkerHandler({ style: args.style, color: args.color, size: 8 });
1342-
1343-
let plainSVG = '<svg width="70" height="70" xmlns="http://www.w3.org/2000/svg">' +
1344-
'<path d="' + handler.create(35,35) + '" stroke="' + handler.getStrokeColor() + '" stroke-width="4" fill="' + handler.getFillColor() + '"/>' +
1345-
'</svg>';
1346-
1347-
let url = 'data:image/svg+xml;utf8,' + plainSVG;
1348-
let loader = new THREE.TextureLoader();
1340+
let handler = new JSROOT.TAttMarkerHandler({ style: args.style, color: args.color, size: 8 }),
1341+
w = handler.fill ? 1 : 7,
1342+
dataUrl = 'data:image/svg+xml;utf8,' +
1343+
'<svg width="70" height="70" xmlns="http://www.w3.org/2000/svg">' +
1344+
`<path d="${handler.create(35,35)}" stroke="${handler.getStrokeColor()}" stroke-width="${w}" fill="${handler.getFillColor()}"/>` +
1345+
'</svg>',
1346+
loader = new THREE.TextureLoader();
13491347

13501348
if (args.promise)
13511349
return new Promise(resolveFunc => {
1352-
loader.load(url, texture => {
1350+
loader.load(dataUrl, texture => {
13531351
material = new THREE.PointsMaterial({ size: (this.webgl ? 3 : 1) * this.scale, map: texture, transparent: true });
13541352
let pnts = new THREE.Points(this.geom, material);
13551353
pnts.nvertex = 1;
@@ -1358,7 +1356,7 @@ JSROOT.define(['d3', 'threejs_jsroot', 'painter'], (d3, THREE, jsrp) => {
13581356
});
13591357

13601358

1361-
let texture = loader.load(url);
1359+
let texture = loader.load(dataUrl);
13621360

13631361
material = new THREE.PointsMaterial({ size: (this.webgl ? 3 : 1) * this.scale, map: texture, transparent: true });
13641362
}

0 commit comments

Comments
 (0)