mirror of
https://github.com/stashapp/stash.git
synced 2026-02-24 16:23:14 +01:00
Fix marker time setting in v2.5 UI (#396)
This commit is contained in:
parent
3de6955a9e
commit
6f5f3112e1
2 changed files with 4 additions and 8 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
MarkerTitleSuggest
|
||||
} from "src/components/Shared";
|
||||
import { useToast } from "src/hooks";
|
||||
import { JWUtils } from "src/utils";
|
||||
|
||||
interface IFormFields {
|
||||
title: string;
|
||||
|
|
@ -20,14 +21,12 @@ interface IFormFields {
|
|||
interface ISceneMarkerForm {
|
||||
sceneID: string;
|
||||
editingMarker?: GQL.SceneMarkerDataFragment;
|
||||
playerPosition?: number;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export const SceneMarkerForm: React.FC<ISceneMarkerForm> = ({
|
||||
sceneID,
|
||||
editingMarker,
|
||||
playerPosition,
|
||||
onClose
|
||||
}) => {
|
||||
const [sceneMarkerCreate] = StashService.useSceneMarkerCreate();
|
||||
|
|
@ -81,7 +80,7 @@ export const SceneMarkerForm: React.FC<ISceneMarkerForm> = ({
|
|||
onReset={() =>
|
||||
fieldProps.form.setFieldValue(
|
||||
"seconds",
|
||||
Math.round(playerPosition ?? 0)
|
||||
Math.round(JWUtils.getPlayer()?.getPosition() ?? 0)
|
||||
)
|
||||
}
|
||||
numericValue={Number.parseInt(fieldProps.field.value ?? "0", 10)}
|
||||
|
|
@ -116,7 +115,8 @@ export const SceneMarkerForm: React.FC<ISceneMarkerForm> = ({
|
|||
const values: IFormFields = {
|
||||
title: editingMarker?.title ?? "",
|
||||
seconds: (
|
||||
editingMarker?.seconds ?? Math.round(playerPosition ?? 0)
|
||||
editingMarker?.seconds ??
|
||||
Math.round(JWUtils.getPlayer()?.getPosition() ?? 0)
|
||||
).toString(),
|
||||
primaryTagId: editingMarker?.primary_tag.id ?? "",
|
||||
tagIds: editingMarker?.tags.map(tag => tag.id) ?? []
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import React, { useState } from "react";
|
|||
import { Button } from "react-bootstrap";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import { WallPanel } from "src/components/Wall/WallPanel";
|
||||
import { JWUtils } from "src/utils";
|
||||
import { PrimaryTags } from "./PrimaryTags";
|
||||
import { SceneMarkerForm } from "./SceneMarkerForm";
|
||||
|
||||
|
|
@ -19,8 +18,6 @@ export const SceneMarkersPanel: React.FC<ISceneMarkersPanelProps> = (
|
|||
GQL.SceneMarkerDataFragment
|
||||
>();
|
||||
|
||||
const jwplayer = JWUtils.getPlayer();
|
||||
|
||||
function onOpenEditor(marker?: GQL.SceneMarkerDataFragment) {
|
||||
setIsEditorOpen(true);
|
||||
setEditingMarker(marker ?? undefined);
|
||||
|
|
@ -40,7 +37,6 @@ export const SceneMarkersPanel: React.FC<ISceneMarkersPanelProps> = (
|
|||
<SceneMarkerForm
|
||||
sceneID={props.scene.id}
|
||||
editingMarker={editingMarker}
|
||||
playerPosition={jwplayer.getPlayer?.().playerPosition}
|
||||
onClose={closeEditor}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue