Skip to content

Commit

Permalink
Merge pull request #677 from Luthaf/more-ts-changes
Browse files Browse the repository at this point in the history
TypeScript: LabelsSpec.alignment can also be a Vector2
  • Loading branch information
dkoes authored May 12, 2023
2 parents 805f345 + 68d6724 commit fa5e8cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/GLViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3623,7 +3623,7 @@ export class GLViewer {
* @param {boolean} clickable - whether click-handling is enabled for the selection
* @param {function} callback - function called when an atom in the selection is clicked. The function is passed
* the selected (foremost) object, the viewer, the triggering event, the associated container, and a list
* of all intersecting objects with their distances from the viewer.
* of all intersecting objects with their distances from the viewer.
*
* @example
$3Dmol.download("cid:307900",viewer,{},function(){
Expand Down Expand Up @@ -4101,7 +4101,7 @@ export class GLViewer {
let surfid = this.nextSurfID();
let mat = null;
let self = this;
let type:SurfaceType = SurfaceType.VDW;
let type: SurfaceType | 0 = SurfaceType.VDW;

if (typeof stype == "string") {
if (GLViewer.surfaceTypeMap[stype.toUpperCase()] !== undefined)
Expand Down
8 changes: 5 additions & 3 deletions src/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ export interface LabelSpec {
useScreen?: boolean;
/** An elment to draw into the label. Any CanvasImageSource is allowed. Label is resized to size of image */
backgroundImage?: any;
/** how to orient the label w/respect to position: topLeft (default), topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight */
alignment?: string;
/** how to orient the label w/respect to position: "topLeft" (default),
* "topCenter", "topRight", "centerLeft", "center", "centerRight",
* "bottomLeft", "bottomCenter", "bottomRight", or an arbitrary offset */
alignment?: string | Vector2;
/** if set, only display in this frame of an animation */
frame?: number;
}
Expand Down Expand Up @@ -272,7 +274,7 @@ export class Label {
);
}

if (style.backgroundImage) {
if (style.backgroundImage) {
this.context.drawImage(img, 0, 0, width, height);
}

Expand Down

0 comments on commit fa5e8cb

Please sign in to comment.