Skip to content

Commit

Permalink
Renamed existing method getParent to getParentId, as suggested in cod…
Browse files Browse the repository at this point in the history
…e review.
  • Loading branch information
neilccbrown committed Dec 3, 2024
1 parent d112e2b commit 4eea3c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Frame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import CaretContainer from "@/components/CaretContainer.vue";
import { useStore } from "@/store/store";
import { DefaultFramesDefinition, CaretPosition, CurrentFrame, NavigationPosition, AllFrameTypesIdentifier, Position, PythonExecRunningState, FrameContextMenuActionName } from "@/types/types";
import VueContext, {VueContextConstructor} from "vue-context";
import { getAboveFrameCaretPosition, getAllChildrenAndJointFramesIds, getLastSibling, getParent, getParentOrJointParent, isFramePartOfJointStructure, isLastInParent } from "@/helpers/storeMethods";
import { getAboveFrameCaretPosition, getAllChildrenAndJointFramesIds, getLastSibling, getParentId, getParentOrJointParent, isFramePartOfJointStructure, isLastInParent } from "@/helpers/storeMethods";
import { CustomEventTypes, getFrameBodyUID, getFrameContextMenuUID, getFrameHeaderUID, getFrameUID, isIdAFrameId, getFrameBodyRef, getJointFramesRef, getCaretContainerRef, setContextMenuEventClientXY, adjustContextMenuPosition, getActiveContextMenu, notifyDragStarted, getCaretUID, getHTML2CanvasFramesSelectionCropOptions } from "@/helpers/editor";
import { mapStores } from "pinia";
import { BPopover } from "bootstrap-vue";
Expand Down Expand Up @@ -839,7 +839,7 @@ export default Vue.extend({
this.appStore.copySelectedFramesToPosition(
{
newParentId: (this.isJointFrame)
? getParent(this.appStore.frameObjects[this.frameId])
? getParentId(this.appStore.frameObjects[this.frameId])
: getParentOrJointParent(this.frameId),
}
);
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/storeMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const removeFrameInFrameList = (frameId: number): void => {
};

// Returns the parentId of the frame or if it is a joint frame returns the parentId of the JointParent.
export const getParent = (currentFrame: FrameObject): number => {
export const getParentId = (currentFrame: FrameObject): number => {
let parentId = 0;
if(currentFrame.id !== 0){
parentId = (currentFrame.jointParentId > 0) ? useStore().frameObjects[currentFrame.jointParentId].parentId : currentFrame.parentId;
Expand All @@ -260,7 +260,7 @@ export const getFrameSectionIdFromFrameId = (frameId: number): number => {
// (We know when we reached a frame section when the id of that frame is negative; all frame sections are defined with a negative index.)
let parentId = frameId;
while(parentId > 0){
parentId = getParent(useStore().frameObjects[parentId]);
parentId = getParentId(useStore().frameObjects[parentId]);
}
return parentId;
};
Expand Down Expand Up @@ -288,7 +288,7 @@ export const childrenListWithJointFrames = (currentFrameId: number, caretPositio

// Create the list of children + joints with which the caret will work with
let childrenAndJointFramesIds = [] as number[];
const parentId = getParent(currentFrame);
const parentId = getParentId(currentFrame);

childrenAndJointFramesIds = [...useStore().frameObjects[parentId].childrenIds];

Expand Down Expand Up @@ -723,11 +723,11 @@ export const isContainedInFrame = function (currFrameId: number, caretPosition:
let isAncestorTypeFound = false;
let frameToCheckId = (caretPosition === CaretPosition.body) ?
currFrameId:
getParent(useStore().frameObjects[currFrameId]);
getParentId(useStore().frameObjects[currFrameId]);

while(frameToCheckId != 0 && !isAncestorTypeFound){
isAncestorTypeFound = containerTypes.includes(useStore().frameObjects[frameToCheckId].frameType.type);
frameToCheckId = getParent(useStore().frameObjects[frameToCheckId]);
frameToCheckId = getParentId(useStore().frameObjects[frameToCheckId]);
}

return isAncestorTypeFound;
Expand Down

0 comments on commit 4eea3c1

Please sign in to comment.