Merge pull request #868 from vangel76/fix-text-typing-866
#866: Layer ▸ New ▸ Text starts typing into Source Text
This commit is contained in:
@@ -274,6 +274,12 @@ fn no_params(p: &Value) -> bool {
|
||||
|
||||
/// Execute a UI or engine command by id.
|
||||
pub fn invoke(app: &mut EffectcraftApp, ctx: &egui::Context, id: &str, params: Value) -> Result<Value, String> {
|
||||
// Layer ▸ New ▸ Text (menu, shortcut, context menus) puts an insertion point in the centre of
|
||||
// the comp, as After Effects does, so typing goes into Source Text rather than running
|
||||
// shortcuts (#866). `engine.execute` keeps the headless default.
|
||||
if id == "layer.newText" && no_params(¶ms) {
|
||||
return run_engine(app, ctx, id, json!({"text": "", "edit": true}));
|
||||
}
|
||||
if no_params(¶ms) && app.ui.focused == PanelKind::Project {
|
||||
match id {
|
||||
"edit.duplicate" => return run_engine(app, ctx, "project.duplicate", json!({})),
|
||||
|
||||
@@ -2672,7 +2672,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
crate::widgets::context_menu(&response, |ui| {
|
||||
let menu = ui.menu_button(crate::i18n::tr("New"), |ui| {
|
||||
for (key, label, command, params) in [
|
||||
("text", "Text", "layer.newText", json!({"text": "Text"})),
|
||||
("text", "Text", "layer.newText", json!({})),
|
||||
("solid", "Solid…", "layer.newSolid", json!({})),
|
||||
("light", "Light…", "layer.newLight", json!({})),
|
||||
("camera", "Camera…", "layer.newCamera", json!({})),
|
||||
@@ -3473,7 +3473,7 @@ pub(crate) fn layer_menu(ui: &mut egui::Ui, layers: &[u64], actions: &mut Vec<(S
|
||||
}
|
||||
};
|
||||
ui.menu_button(crate::i18n::tr("New"), |ui| {
|
||||
item(ui, "Text", "layer.newText", json!({"text": "Text"}));
|
||||
item(ui, "Text", "layer.newText", json!({}));
|
||||
item(ui, "Solid…", "app.solidSettings", json!({}));
|
||||
item(ui, "Light…", "layer.newLight", json!({}));
|
||||
item(ui, "Camera…", "layer.newCamera", json!({}));
|
||||
|
||||
Reference in New Issue
Block a user