Skip to content

fix mobile ux - #6

Open
FedericoDiTosto wants to merge 8 commits into
AlasdairMott:workingfrom
FedericoDiTosto:mobile-tap-to-preview
Open

fix mobile ux#6
FedericoDiTosto wants to merge 8 commits into
AlasdairMott:workingfrom
FedericoDiTosto:mobile-tap-to-preview

Conversation

@FedericoDiTosto

Copy link
Copy Markdown
Contributor

I open this draft pull request to check for bugs.

this pull request attempts to resolve the issue: Mobile - tap to preview.

the mobile mode button allows you to enter a real mobile mode in which mouse hovers are not possible. A tap does not add a block but a preview of it, it is editable until the confirm/cancel button is clicked (black buttons that come out when the preview block is created)

possible problems:
-during the editing of a preview block, upon clicking on a grid point the preview is closed(as if clicking cancel)
-animation lags for a moment when placing a block

@vercel

vercel Bot commented Nov 10, 2022

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
block-builder ✅ Ready (Inspect) Visit Preview Nov 15, 2022 at 10:30AM (UTC)

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

solved grid click problem

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

solved animation lag

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

-make it go into mobile mode based on the width of the device, should be maximum 1024px (tablet in landscape mode) may be a good idea?

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

Now when orbitcontrol starts to change the preview is hidden #3

solved:
#5 and #3 issues

Comment thread src/3d/Viewport3d.tsx
<Canvas shadows={true} onKeyDown={handleKeyPress}>
<color attach="background" args={[0.9, 0.9, 0.9]} />
<OrbitControls target={cameraTarget} />
<OrbitControls target={cameraTarget} onStart={() => { dispatch(toggleOrbiting()) }} onEnd={() => { dispatch(toggleOrbiting()) }} />

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhhh thanks for solving this one.
Do you mind If I extract your fix and make it a separate PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, no problem

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theres a bit of a performance hit doing this via a state. Might need to investage a different solution. I wonder if the faces can store a pointer to the orbit controls and listen directly?

Nov-15-2022.17-17-01.mp4

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a go using references, but I might have a simpler option... track the delta of the mouse on mouseDown

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to references... PR here #7

Comment thread src/3d/Viewport3d.tsx Outdated
</Canvas>
<Toolbar onZoomExtents={zoomExtents} onTogglePerspective={handleTogglePerspective} onNewFile={handleNewFile}></Toolbar>
<MobileButton onActivate={() => dispatch(toggleMobileMode())} />
{mobileModeActive && <MobileSelector cam={cameraTarget} onClose={() => dispatch(toggleMobileMode())} />}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile Button and Mobile Selector should probably exist in their own component now

<MobileTools/>

Comment thread src/Grid/Face.tsx Outdated
else {
setHover(true);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be orbiting ? setHover(false) : setHover(true); to be more concise

Comment thread src/UI/Toolbar.tsx
<ToolbarCommandButton onClick={() => dispatch(ActionCreators.undo())} title={Command[Command.Undo]}><Undo {...ICONPROPS} /></ToolbarCommandButton>
<ToolbarCommandButton onClick={() => dispatch(ActionCreators.redo())} title={Command[Command.Redo]}><Redo {...ICONPROPS} /></ToolbarCommandButton>
<ToolbarCommandButton onClick={() => setShowShare(!showShare)} title={Command[Command.Share]}><ShareIos {...ICONPROPS} /></ToolbarCommandButton>
<ToolbarCommandButton onClick={() => { placedPreview ? dispatch(togglePlacedPreview()) : dispatch(ActionCreators.undo()); }} title={Command[Command.Undo]}><Undo {...ICONPROPS} /></ToolbarCommandButton>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how was the preview affecting the undo redo? I wonder if we can simplify

@AlasdairMott

Copy link
Copy Markdown
Owner

image

I'm worried the additional icons a making the interface a littler cluttered. Is it possible to click (or tap) the hovered block to confirm? It's a bigger target too.

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

Removed the buttons, now confirm by clicking on the preview block.
To do this I created a new model specifically for the mobile version that responds to clicking on the model itself (without using Plane on all faces), I'm not sure this is the best approach.

To remove the preview just click outside the model(it does not immediately create a new preview at the clicked point)

@FedericoDiTosto

Copy link
Copy Markdown
Contributor Author

For the undo/redo how do I deal with the preview?

@AlasdairMott

Copy link
Copy Markdown
Owner

The click to preview/click to place is working well.

For the undo/redo how do I deal with the preview?

I'm not sure the preview should be part of the ui state. Maybe just per block as it is now?

Comment thread src/UI/MobileMode.tsx
};

export { MobileButton, MobileSelector };
const MobileTools = () => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

Comment thread src/store/ui.ts
perspective: false,
mobileMode: false,
placedPreview: false,
previewBlockIds: {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if previewBlockIds should be a part of the state

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I then remove it from the reducer-ui and put it as an object in Face.tsx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants