Skip to content

Drag Panel

anidivr edited this page Oct 30, 2022 · 2 revisions

Draggable window panel. Panel can be expanded, collapsed, resized and closed.

image

drag-panel code

Inputs

Name Type Default Description
title string blank Panel title
titlefontsize number 0.07 Size of title font
overflow number 16 Number of characters to display before text is truncated
width number 1 Width of panel in meters
minwidth number 0.5 Minimum width allowed when resizing
height number 1 Height of panel in meters
minheight number 0.5 Minimum height allowed when resizing
resizable boolean false When true, resizing the window is allowed. When false, resizing is now allowed
expanded boolean true When true, panel is visible. When false, panel is not visible
scalable boolean true When true, scaling the window is allowed. When false, scaling is not allowed
minscale number 0.5 The minimum scale allowed for the window
locked boolean false When true, dragging is disabled. When false, dragging is allowed
showexpand boolean true When true, button to expand and collapse is visible. When false, button is not visible
showclose boolean true When true, close button is visible. When false, close button is not visible and close is now allowed
selectable InteractiveObjects undefined Add to list of objects ray caster can test for overlap
panelmaterial Material Theme panel material (color black) Panel background material. Set to override with custom material
titlematerial Material Theme panel material (panel color, transparent, opacity=0.3) Panel title material. Set to override with custom material
outlinematerial LineBasicMaterial Theme outline material (color white) Outline material. Set to override with custom material
labelmaterial Material Theme label material (color white) Title label material. Set to override with custom material
scalematerial Material Theme scale material (color white) Scale material. Set to override with custom material
resizematerial Material Theme scale material (color white) Resize material. Set to override with custom material

Outputs

Name Type Description
close boolean Triggered when close button selected. Event value is always true
widthchange number Triggered when width changes due to resizing
heightchange number Triggered when height changes due to resizing

Examples

<flat-ui-drag-panel *ngIf="showimage" [title]="'Image Panel'" [showexpand]="false" [locked]="true" 
               [resizable]="false" [width]="2" [height]="1.5" [panelmaterial]="panelmaterial"
               [position]="[1.6, 1, -2.001]" [rotation]="[0, -30 | radian, 0]" [selectable]="selectable" 
               (close)="showimage=false">
  <ng-template let-parent="parent">
    <ngt-group [appendTo]="parent" [position]="[0, 0, 0.002]">
      <ngt-mesh>
        <ngt-plane-geometry [args]="[1.95, 1.45]"></ngt-plane-geometry>
        <ngt-mesh-standard-material [map]="texture"></ngt-mesh-standard-material>
      </ngt-mesh>
    </ngt-group>
  </ng-template>
</flat-ui-drag-panel>
Clone this wiki locally