Improve readability of rendering test

This commit is contained in:
Andreas Hocevar
2020-11-15 09:20:33 +01:00
parent 7232001d9f
commit 0a5483043d

View File

@@ -10,176 +10,79 @@ import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js'; import VectorSource from '../../../src/ol/source/Vector.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
const vectorSource = new VectorSource(); const vectorSource = new VectorSource({
let feature; features: [
// Latin - end (right)
// Latin - end (right) new Feature({
feature = new Feature({ geometry: new Point([-10, 50]),
geometry: new Point([-10, 50]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'Latin', text: 'Latin',
font: '24px Ubuntu',
textAlign: 'end', textAlign: 'end',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
// Hebrew - start (right) // Hebrew - start (right)
feature = new Feature({ new Feature({
geometry: new Point([-10, 0]), geometry: new Point([-10, 0]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'עִברִית', text: 'עִברִית',
font: '24px Ubuntu',
textAlign: 'start', textAlign: 'start',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
// Arabic - start (right) // Arabic - start (right)
feature = new Feature({ new Feature({
geometry: new Point([-10, -50]), geometry: new Point([-10, -50]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'عربى', text: 'عربى',
font: '24px Ubuntu',
textAlign: 'start', textAlign: 'start',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
// Latin - start (left) // Latin - start (left)
feature = new Feature({ new Feature({
geometry: new Point([10, 50]), geometry: new Point([10, 50]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'Latin', text: 'Latin',
font: '24px Ubuntu',
textAlign: 'start', textAlign: 'start',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
// Hebrew - end (left) // Hebrew - end (left)
feature = new Feature({ new Feature({
geometry: new Point([10, 0]), geometry: new Point([10, 0]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'עִברִית', text: 'עִברִית',
font: '24px Ubuntu',
textAlign: 'end', textAlign: 'end',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
// Arabic - end (left) // Arabic - end (left)
feature = new Feature({ new Feature({
geometry: new Point([10, -50]), geometry: new Point([10, -50]),
});
feature.setStyle(
new Style({
text: new Text({
text: 'عربى', text: 'عربى',
font: '24px Ubuntu', font: '24px Ubuntu',
textAlign: 'end', textAlign: 'end',
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}), }),
image: new CircleStyle({ ],
radius: 10, });
fill: new Fill({
color: 'cyan',
}),
}),
})
);
vectorSource.addFeature(feature);
new Map({ new Map({
pixelRatio: 1, pixelRatio: 1,
layers: [ layers: [
new VectorLayer({ new VectorLayer({
source: vectorSource, source: vectorSource,
style: function (feature) {
return new Style({
text: new Text({
text: feature.get('text'),
font: '24px Ubuntu',
textAlign: feature.get('textAlign'),
fill: new Fill({
color: 'black',
}),
stroke: new Stroke({
color: 'white',
}),
}),
image: new CircleStyle({
radius: 10,
fill: new Fill({
color: 'cyan',
}),
}),
});
},
}), }),
], ],
target: 'map', target: 'map',