protected virtual void update_value(double newValue, bool bSendEvent) { double prev = current_value; current_value = newValue; snapped_value = current_value; if (EnableSnapToTicks && TickCount > 0) { double fTickSpan = 1.0 / (TickCount - 1); double fSnapped = Snapping.SnapToIncrement(snapped_value, fTickSpan); fSnapped = MathUtil.Clamp(fSnapped, 0, 1); // [RMS] only snap when close enough to tick? //double fSnapT = fTickSpan * 0.25; //if (Math.Abs(fSnapped - snapped_value) < fSnapT) snapped_value = fSnapped; } update_handle_position(); if (bSendEvent) { FUtil.SafeSendEvent(OnValueChanged, this, prev, snapped_value); } }
protected virtual void onSliderbarPress(InputEvent e, Vector3f hitPosW) { double t = get_slider_tx(hitPosW); FUtil.SafeSendEvent(OnValueChangeBegin, this, snapped_value); update_value(t, true); }
protected void standard_end_capture(InputEvent e, InteractionMode eMode) { if (eMode == InteractionMode.InHandleDrag || eMode == InteractionMode.InPressDrag) { FUtil.SafeSendEvent(OnValueChangeEnd, this, snapped_value); } }
override public bool EndCapture(InputEvent e) { if (FindHitGO(e.ray)) { if (sent_click == false) { // on first click we reset timer FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); sent_click = true; last_click_time = FPlatform.RealTime(); } else { float delta = FPlatform.RealTime() - last_click_time; if (delta < double_click_delay) { // if this second click comes fast enough, send doubleclick instead FUtil.SafeSendEvent(OnDoubleClicked, this, new EventArgs()); sent_click = false; last_click_time = 0.0f; } else { // send single-click and reset timer FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); sent_click = true; last_click_time = FPlatform.RealTime(); } } } return(true); }
protected virtual void update_value(double newValue, bool bSendEvent) { double prev = current_value; current_value = newValue; snapped_value = current_value; if (TickSnapMode != TickSnapModes.NoSnapping && TickCount > 0) { if (TickSnapMode == TickSnapModes.AlwaysSnapToNearest) { double fTickSpan = 1.0 / (TickCount - 1); double fSnapped = Snapping.SnapToIncrement(snapped_value, fTickSpan); fSnapped = MathUtil.Clamp(fSnapped, 0, 1); snapped_value = fSnapped; } else { double fTickSpan = 1.0 / (TickCount - 1); double fSnapped = Snapping.SnapToIncrement(snapped_value, fTickSpan); if (Math.Abs(fSnapped - snapped_value) < TickSnapThreshold) { snapped_value = fSnapped; } } } update_handle_position(); if (bSendEvent) { FUtil.SafeSendEvent(OnValueChanged, this, prev, snapped_value); } }
public bool AddOrUpdateKey(Keyframe f) { if (f.Time < validMin || f.Time > validMax) { throw new gException("KeyframeSequence.AddKey: time {0} is out of valid range", f.Time); } IChangeOp change; if (Keys.ContainsKey(f.Time)) { Keyframe prev = Keys[f.Time]; change = new KeyframeUpdateChange() { before = prev, after = f, sequence = this }; } else { change = new KeyframeAddRemoveChange() { key = f, sequence = this, bAdded = true }; } add_or_update_key(f); FUtil.SafeSendEvent(ChangeOpEvent, this, change); return(true); }
public void Clear() { real_text = new SecureString(); dummy_text = ""; UpdateText(); cursor_position = 0; FUtil.SafeSendEvent(OnTextChanged, this, dummy_text); }
public void Disconnect() { foreach (var ui in Children) { ui.Disconnect(); } FUtil.SafeSendEvent(OnDisconnected, this, EventArgs.Empty); }
public void Disconnect() { if (bDestroyOnDisconnect) { dummyGO.Destroy(); } FUtil.SafeSendEvent(OnDisconnected, this, EventArgs.Empty); }
override public bool EndCapture(InputEvent e) { if (IsGOHit(e.ray, popupMesh)) { FUtil.SafeSendEvent(OnDismissed, this, new EventArgs()); } return(true); }
override public bool EndCapture(InputEvent e) { if (eInterMode == InteractionMode.InCustom) { custom_end_capture(e); } else if (eInterMode == InteractionMode.InHandleDrag || eInterMode == InteractionMode.InPressDrag) { FUtil.SafeSendEvent(OnValueChangeEnd, this, snapped_value); } return(true); }
public void PopCharacter() { if (real_text.Length > 0) { real_text.RemoveAt(real_text.Length - 1); dummy_text = dummy_text.Substring(0, real_text.Length); UpdateText(); cursor_position = MathUtil.Clamp(cursor_position - 1, 0, dummy_text.Length); FUtil.SafeSendEvent(OnTextChanged, this, dummy_text); } }
public bool RemoveKey(double time) { if (Keys.ContainsKey(time)) { Keyframe f = Keys[time]; remove_key(time); FUtil.SafeSendEvent(ChangeOpEvent, this, new KeyframeAddRemoveChange() { key = f, sequence = this, bAdded = false }); return(true); } return(false); }
public bool UpdateKey(Keyframe f) { if (Keys.ContainsKey(f.Time)) { Keyframe prev = Keys[f.Time]; IChangeOp change = new KeyframeUpdateChange() { before = prev, after = f, sequence = this }; Keys[f.Time] = f; FUtil.SafeSendEvent(ChangeOpEvent, this, change); return(true); } return(false); }
public bool AppendCharacter(char c) { if (CharacterValidatorF != null && CharacterValidatorF(c) == false) { return(false); } real_text.AppendChar(c); dummy_text += "*"; UpdateText(); cursor_position = MathUtil.Clamp(cursor_position + 1, 0, dummy_text.Length); FUtil.SafeSendEvent(OnTextChanged, this, dummy_text); return(true); }
override public bool EndCapture(InputEvent e) { if (FindHitGO(e.ray)) { if (EnableClickToDismiss) { Dismiss(); } else { // send single-click and reset timer FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); } } return(true); }
virtual public void Disconnect() { // we could get this while we are in an active capture, if selection // changes. in that case we need to terminate gracefully. if (activeWidget != null) { EndCapture(null); } if (targetWrapper != null) { targetWrapper.Target.OnTransformModified -= onTransformModified; } FUtil.SafeSendEvent(OnDisconnected, this, EventArgs.Empty); }
void update_progress(double newValue, bool bSendEvent) { if (newValue != current_progress) { double prev = current_progress; current_progress = newValue; update_geometry(); if (bSendEvent) { FUtil.SafeSendEvent(OnProgressChanged, this, prev, current_progress); if (current_progress == max_progress) { FUtil.SafeSendEvent(OnProgressCompleted, this, max_progress); } } } }
public bool SetText(string newText, bool bFromUserInput = true) { string validated = validate_text(text, newText); if (validated != text) { text = validated; UpdateText(); FUtil.SafeSendEvent(OnTextChanged, this, text); if (bFromUserInput) { FUtil.SafeSendEvent(OnTextEdited, this, text); } return(true); } return(false); }
public bool AddKey(Keyframe f) { if (f.Time < validMin || f.Time > validMax) { throw new gException("KeyframeSequence.AddKey: time {0} is out of valid range", f.Time); } if (Keys.ContainsKey(f.Time)) { throw new gException("KeyframeSequence.AddKey: key already exists at time {0}!", f.Time); } add_or_update_key(f); FUtil.SafeSendEvent(ChangeOpEvent, this, new KeyframeAddRemoveChange() { key = f, sequence = this, bAdded = true }); return(true); }
void begin_editing() { // start capturing input if (OverrideDefaultInputHandling == false) { HUDTextEntryTarget entry = new HUDTextEntryTarget(this); if (Parent.Context.RequestTextEntry(entry)) { active_entry = entry; FUtil.SafeSendEvent(OnBeginTextEditing, this); bgMesh.SetMaterial(activeBackgroundMaterial); start_active_time = FPlatform.RealTime(); cursor_position = text.Length; entry.OnTextEditingEnded += (s, e) => { bgMesh.SetMaterial(backgroundMaterial); active_entry = null; FUtil.SafeSendEvent(OnEndTextEditing, this); }; } } }
public void ApplyTransformation(Func <Frame3f, Frame3f> TransformF) { List <IChangeOp> changes = new List <IChangeOp>(); foreach (Keyframe k in Keys.Values) { IChangeOp change = new KeyframeUpdateChange() { sequence = this, before = k, after = new Keyframe(k.Time, TransformF(k.Frame)) }; changes.Add(change); } for (int i = 0; i < changes.Count; ++i) { changes[i].Apply(); FUtil.SafeSendEvent(ChangeOpEvent, this, changes[i]); } FUtil.SafeSendEvent(ModifiedEvent, this, null); }
override public bool EndCapture(InputEvent e) { if (Parent == null) { DebugUtil.Log(2, "HUDLabel.EndCapture: our parent went invalid while we were capturing!"); return(true); } if (FindHitGO(e.ray)) { if (sent_click == false) { // on first click we reset timer FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); sent_click = true; last_click_time = FPlatform.RealTime(); } else { float delta = FPlatform.RealTime() - last_click_time; if (delta < double_click_delay) { // if this second click comes fast enough, send doubleclick instead FUtil.SafeSendEvent(OnDoubleClicked, this, new EventArgs()); sent_click = false; last_click_time = 0.0f; } else { // send single-click and reset timer FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); sent_click = true; last_click_time = FPlatform.RealTime(); } } } return(true); }
public virtual void Disconnect() { // we could get this while we are in an active capture, if selection // changes. in that case we need to terminate gracefully. if (activeWidget != null) { EndCapture(null); } foreach (var w in Widgets) { w.Value.Disconnect(); } Widgets.Clear(); if (targetWrapper != null) { targetWrapper.Target.OnTransformModified -= onTransformModified; } // if we created an internal group SO, get rid of it if (internalGroupSO != null) { internalGroupSO.RemoveAllChildren(); parentScene.RemoveSceneObject(internalGroupSO, true); internalGroupSO = null; } // same for xform if (internalXFormSO != null) { internalXFormSO.DisconnectTarget(); parentScene.RemoveSceneObject(internalXFormSO, true); internalXFormSO = null; } FUtil.SafeSendEvent(OnDisconnected, this, EventArgs.Empty); }
public void selected(object sender) { FUtil.SafeSendEvent(OnSelected, sender, new EventArgs()); }
protected virtual void OnSelectionChanged(EventArgs e) { FUtil.SafeSendEvent(SelectionChangedEvent, this, e); }
void on_double_clicked() { FUtil.SafeSendEvent(OnDoubleClicked, this, new EventArgs()); }
void on_clicked() { begin_editing(); FUtil.SafeSendEvent(OnClicked, this, new EventArgs()); }
void add_or_update_key(Keyframe f) { Keys[f.Time] = f; FUtil.SafeSendEvent(ModifiedEvent, this, null); }
void remove_key(double time) { Keys.Remove(time); FUtil.SafeSendEvent(ModifiedEvent, this, null); }