Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// VisibleTileSet we can be sure that the current zoomlevel matches the zoomlevel where
// the tile should be shown.
const displayZoomLevel = this.mapView.zoomLevel;
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: technique.fadeNear;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: technique.fadeFar;
const xOffset = getPropertyValue(technique.xOffset, displayZoomLevel);
const yOffset = getPropertyValue(technique.yOffset, displayZoomLevel);
const textElement: TextElement = new TextElement(
ContextualArabicConverter.instance.convert(text),
positions,
textElementsRenderer.styleCache.getRenderStyle(tile, technique),
textElementsRenderer.styleCache.getLayoutStyle(tile, technique),
getPropertyValue(priority, displayZoomLevel),
xOffset !== undefined ? xOffset : 0.0,
yOffset !== undefined ? yOffset : 0.0,
featureId,
technique.style,
fadeNear,
fadeFar
);
textElement.mayOverlap = technique.textMayOverlap === true;
textElement.reserveSpace = technique.textReserveSpace !== false;
textElement.alwaysOnTop = technique.alwaysOnTop === true;
textElement.userData = userData;
const textPosition: THREE.Vector3 = new THREE.Vector3(0, window.innerHeight / 2.0, 0.0);
let recordingPosition = false;
const textBounds: THREE.Box2 = new THREE.Box2(new THREE.Vector2(), new THREE.Vector2());
const characterBounds: THREE.Box2[] = [];
let boundsScene: THREE.Scene;
let boundsVertexBuffer: THREE.BufferAttribute;
let boundsGeometry: THREE.BufferGeometry;
let boundsObject: THREE.Object3D;
let gridScene: THREE.Scene;
// tslint:disable:max-line-length
const characterCount = 32768;
let textBuffer: TextBufferObject | undefined;
const textSample = ContextualArabicConverter.instance.convert(`LATIN
Lorem ipsum dolor sit amet, cum omnis solet consequuntur id, cum aliquid torquatos cu. Probo porro nominavi quo no, ut vix congue officiis. Homero principes posidonium eam at. Pro movet fuisset volumus at, sea ad vidit maluisset consequat. Ne cum scaevola recusabo. Ea simul prodesset sea.
Nonumy consul delicata mea an. Pro et mollis conclusionemque, falli fierent ad has, ei eos commodo molestiae. Alia wisi doming his ut, usu et tota altera. Sit eu errem tractatos definitionem, vix ut exerci nominati assueverit. Tota maiorum expetendis pro at, cu pro consul nusquam.
Vidit nostrud at nam. Volumus evertitur eos cu, te wisi cetero sea, eum ad suas atqui voluptatibus. Ipsum vidisse adipiscing at per, nec consul feugiat ea, dicant eleifend adolescens ut nam. Novum possit neglegentur ad est, te vim ignota expetenda. Id his facer repudiare, in eam suas nominati percipitur. Quis reprehendunt ad mea, nec erat inani in.
Iisque delicatissimi eum ex. Mutat ornatus veritus sea ad, delicata omittantur ex pri. Nibh option ne eum, aeque deleniti sententiae at vix, ne sale novum delicatissimi his. Et vix voluptua deserunt, ut velit dicit sea. An dolor regione recusabo nec. Mea simul definitiones ad, no persius volumus definiebas has, no munere perpetua dignissim mel.
At vide honestatis cum. Sit eu aeterno scriptorem, saepe docendi ut usu, mei et dicant elaboraret intellegam. Possit essent alterum ei sea, enim admodum ea nec. Homero tamquam at vix, in meliore appetere invidunt eos. Eu qui probo regione. Vulputate repudiandae nam et.
His regione fabulas no, ex his quodsi aliquam. Modus impedit ex vis, esse purto magna vis ut, justo evertitur vel eu. Mel consul maiestatis dissentiunt an. Ei duo aeque oblique petentium.
Qui te autem commodo sententiae. At eum purto detraxit definitionem, duo ei graecis postulant erroribus. Id purto principes vis, mel summo inermis posidonium et. Prima impetus invidunt sed at. Aperiam luptatum mnesarchum per an, eripuit electram disputando ad sea, per eu veniam vituperatoribus. Odio verterem te sit. Cum ne odio minim indoctum, modus dolore ad nam.
Ne debet vituperata usu, nec vero partem quodsi eu. Mea in sint augue accusam. Diam solum denique vis at, prima verear ornatus ei nam, quo facer verterem pericula ea. Fabellas recusabo consetetur quo ei, per ad vulputate rationibus complectitur. Te amet vitae sit, neglegentur instructior voluptatibus ut sed.
Debitis disputando duo te. Vel vide labitur petentium eu. Atqui facer discere usu id. Duo justo principes aliquando te. Duo ea blandit oporteat.
His in nibh idque, cu dicant civibus tincidunt vix. Vix vidit constituto ex. Cu mea fierent voluptatum, diam minimum nominati ea vis, te brute doming vim. Soluta explicari mea ei, ut tota melius reprehendunt sed. Quo ex essent nostro malorum, elitr iracundia percipitur mei no, quod nullam in mei.
CYRILLIC
Лорем ипсум долор сит амет, усу унум персеяуерис еа, при цлита цомплецтитур ет, пробатус волуптатум медиоцритатем яуи ех. Фацер лудус дефинитионес цу вел, еа убияуе дицерет волуптатум яуи. Алии интегре сеа ех, вих ид путент денияуе. Но инвидунт еффициенди цомплецтитур вис.
Усу еи веро иусто плацерат, детрахит волутпат яуи еа. Деленит цотидиеяуе ех сед. Ат пробо антиопам аццоммодаре нец. Хис граецис вивендум ад, вим еи яуас ессент адмодум. Еу пондерум легендос интеллегат меа.
Еу сед тале уллум, сеа ид нулла солет улламцорпер, ин либер диссентиунт нам. Сусципит апеириан сапиентем вел еа, пробо перципитур хис ан, поссим репрехендунт ех еам. Вим цу виси интеллегам. Сеа еи лаборес доценди, мазим популо алияуам ид ест, ат еос ностро репудиандае. Ад партем платонем еос, пер яуод вирис муциус цу, усу цу видиссе репудиаре.
Малорум петентиум ратионибус меа цу, мел постеа аццусамус ан. Ад фацер убияуе омиттам иус, еум еи делецтус ехпетендис. Диспутандо сигниферумяуе те яуо, ест ет стет либер елитр. Ат нонумы легере вел, ин вис алиа граецо цонсулату. Еа перицулис витуператорибус нам.
position: THREE.Vector3,
technique: PoiTechnique,
zoomLevel: number,
geojsonProperties?: {}
) {
const label = DEFAULT_LABELED_ICON.label;
const priority =
technique.priority === undefined ? DEFAULT_LABELED_ICON.priority : technique.priority;
const xOffset = getPropertyValue(technique.xOffset, zoomLevel);
const yOffset = getPropertyValue(technique.yOffset, zoomLevel);
const featureId = DEFAULT_LABELED_ICON.featureId;
const styleCache = this.mapView.textElementsRenderer.styleCache;
const textElement = new TextElement(
ContextualArabicConverter.instance.convert(label),
position,
styleCache.getRenderStyle(this, technique),
styleCache.getLayoutStyle(this, technique),
getPropertyValue(priority, this.mapView.zoomLevel),
xOffset === undefined ? DEFAULT_LABELED_ICON.xOffset : xOffset,
yOffset === undefined ? DEFAULT_LABELED_ICON.yOffset : yOffset,
featureId
);
// Set the userData of the TextElement to the geojsonProperties, then it will be available
// for picking.
if (geojsonProperties !== undefined) {
textElement.userData = geojsonProperties;
}
const mayOverlap =
indices.push(pointIndex - 4);
indices.push(pointIndex - 3);
indices.push(pointIndex - 2);
indices.push(pointIndex - 4);
indices.push(pointIndex - 2);
indices.push(pointIndex - 1);
if (debugTextPathsFull) {
// give point index a label
const label: string =
pathIndex % 5 === 0
? text + ":" + pathIndex
: Number(pathIndex).toString();
const labelElement = new TextElement(
ContextualArabicConverter.instance.convert(label),
new THREE.Vector3(x + worldOffsetX, y, z),
textRenderStyle,
textLayoutStyle,
getPropertyValue(technique.priority || 0, zoomLevel),
technique.xOffset || 0.0,
technique.yOffset || 0.0
);
labelElement.minZoomLevel = technique.minZoomLevel;
labelElement.mayOverlap = true;
labelElement.reserveSpace = false;
labelElement.alwaysOnTop = true;
labelElement.ignoreDistance = true;
this.addUserTextElement(labelElement);
}
}
}
gui.add(guiOptions, "input").onFinishChange((value: string) => {
textSample = ContextualArabicConverter.instance.convert(value);
assetsLoaded = false;
textCanvas.fontCatalog.loadCharset(textSample, textRenderStyle).then(() => {
assetsLoaded = true;
});
});
gui.add(guiOptions, "gridEnabled");
r: 0.0,
g: 0.0,
b: 0.0
}
};
let webglRenderer: THREE.WebGLRenderer;
let camera: THREE.OrthographicCamera;
let textCanvas: TextCanvas;
let textLayoutStyle: TextLayoutStyle;
let textRenderStyle: TextRenderStyle;
let assetsLoaded: boolean = false;
const characterCount = 512;
const textSample = ContextualArabicConverter.instance.convert(`
egypt
مصر
bahrain مصر kuwait
The title is مفتاح معايير الويب, in Arabic.
one two ثلاثة 1234 خمسة
one two ثلاثة ١٢٣٤ خمسة
0123456789
The title is مفتاح (معايير) الويب, in Arabic.
r: 0.0,
g: 0.0,
b: 0.0
}
};
let webglRenderer: THREE.WebGLRenderer;
let camera: THREE.OrthographicCamera;
let textCanvas: TextCanvas;
let textLayoutStyle: TextLayoutStyle;
let textRenderStyle: TextRenderStyle;
let assetsLoaded: boolean = false;
const characterCount = 256;
const textSample = ContextualArabicConverter.instance.convert(`
egypt
مصر
bahrain مصر kuwait
The title is مفتاح معايير الويب, in Arabic.
one two ثلاثة 1234 خمسة
one two ثلاثة ١٢٣٤ خمسة
0123456789
The title is مفتاح (معايير) الويب, in Arabic.
* [[TextCanvasMinimalExample]] documentation.
*/
export namespace TextCanvasMeasureExample {
const stats = new Stats();
let webglRenderer: THREE.WebGLRenderer;
let camera: THREE.OrthographicCamera;
let currentFrameTime = new Date().getTime();
let lastFrameTime = new Date().getTime();
let textCanvas: TextCanvas;
let assetsLoaded: boolean = false;
const characterCount = 16;
const textSampleA = "Hello World!";
const textSampleB = ContextualArabicConverter.instance.convert("الأندلس");
const textPosition: THREE.Vector3 = new THREE.Vector3();
const textBounds: THREE.Box2 = new THREE.Box2(new THREE.Vector2(), new THREE.Vector2());
const characterBounds: THREE.Box2[] = [];
let boundsScene: THREE.Scene;
let boundsVertexBuffer: THREE.BufferAttribute;
let boundsGeometry: THREE.BufferGeometry;
function initDebugBounds() {
boundsScene = new THREE.Scene();
boundsVertexBuffer = new THREE.BufferAttribute(
new Float32Array(32 * 4 * characterCount),
4
);
boundsVertexBuffer.setDynamic(true);
boundsGeometry = new THREE.BufferGeometry();
: 0) +
(maxPathLengthSqr > 0
? (SORT_WEIGHT_PATH_LENGTH * textPath.pathLengthSqr) / maxPathLengthSqr
: 0);
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: technique.fadeNear;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: technique.fadeFar;
const userData = textPath.objInfos;
const featureId = getFeatureId(userData);
const textElement = new TextElement(
ContextualArabicConverter.instance.convert(textPath.text),
path,
textElementsRenderer.styleCache.getRenderStyle(tile, technique),
textElementsRenderer.styleCache.getLayoutStyle(tile, technique),
priority,
technique.xOffset !== undefined ? technique.xOffset : 0.0,
technique.yOffset !== undefined ? technique.yOffset : 0.0,
featureId,
technique.style,
fadeNear,
fadeFar
);
textElement.minZoomLevel =
technique.minZoomLevel !== undefined
? technique.minZoomLevel
: mapView.minZoomLevel;
textElement.maxZoomLevel =