Skip to content

Commit 154368e

Browse files
committed
gui-side unclamp direction
1 parent 61e36b5 commit 154368e

File tree

5 files changed

+47
-1
lines changed

5 files changed

+47
-1
lines changed

src/components/tw-settings-modal/settings-modal.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ const DisableOffscreenRendering = props => (
314314
// slug="out-of-bounds-rendering"
315315
/>
316316
);
317+
const DisableDirectionClamping = props => (
318+
<BooleanSetting
319+
{...props}
320+
label={
321+
<FormattedMessage
322+
defaultMessage="Disable Direction Clamping"
323+
description="Disable Direction Clamping setting"
324+
id="pm.settingsModal.noDirWrap"
325+
/>
326+
}
327+
help={
328+
<FormattedMessage
329+
defaultMessage="When enabled, directions will not be clamped from -179 - 180"
330+
description="Disable Direction Clamping setting help"
331+
id="pm.settingsModal.noDirWrapHelp"
332+
/>
333+
}
334+
// slug="out-of-bounds-rendering"
335+
/>
336+
);
317337

318338
const WarpTimer = props => (
319339
<BooleanSetting
@@ -546,6 +566,10 @@ const SettingsModalComponent = props => (
546566
value={props.dangerousOptimizations}
547567
onChange={props.onEnableDangerousOptimizationsChange}
548568
/>
569+
<DisableDirectionClamping
570+
value={props.disableDirectionClamping}
571+
onChange={props.onDisableDirectionClamping}
572+
/>
549573
<Header>
550574
<FormattedMessage
551575
defaultMessage="Screen Resolution"

src/containers/tw-settings-modal.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class UsernameModal extends React.Component {
3333
'handleDisableCompilerChange',
3434
'handleStoreProjectOptions',
3535
'handleEnableDangerousOptimizationsChange',
36-
'handleDisableOffscreenRenderingChange'
36+
'handleDisableOffscreenRenderingChange',
37+
'handleDisableDirectionClamping'
3738
]);
3839
}
3940
handleFramerateChange (e) {
@@ -79,6 +80,11 @@ class UsernameModal extends React.Component {
7980
disableOffscreenRendering: e.target.checked
8081
});
8182
}
83+
handleDisableDirectionClamping (e) {
84+
this.props.vm.setRuntimeOptions({
85+
disableDirectionClamping: e.target.checked
86+
});
87+
}
8288
handleWarpTimerChange (e) {
8389
this.props.vm.setCompilerOptions({
8490
warpTimer: e.target.checked
@@ -131,6 +137,7 @@ class UsernameModal extends React.Component {
131137
onRemoveLimitsChange={this.handleRemoveLimitsChange}
132138
onEnableDangerousOptimizationsChange={this.handleEnableDangerousOptimizationsChange}
133139
onDisableOffscreenRenderingChange={this.handleDisableOffscreenRenderingChange}
140+
onDisableDirectionClamping={this.handleDisableDirectionClamping}
134141
onWarpTimerChange={this.handleWarpTimerChange}
135142
onStageWidthChange={this.handleStageWidthChange}
136143
onStageHeightChange={this.handleStageHeightChange}
@@ -189,6 +196,7 @@ const mapStateToProps = state => ({
189196
removeFencing: !state.scratchGui.tw.runtimeOptions.fencing,
190197
removeLimits: !state.scratchGui.tw.runtimeOptions.miscLimits,
191198
disableOffscreenRendering: state.scratchGui.tw.runtimeOptions.disableOffscreenRendering,
199+
disableDirectionClamping: state.scratchGui.tw.runtimeOptions.disableDirectionClamping,
192200
dangerousOptimizations: state.scratchGui.tw.runtimeOptions.dangerousOptimizations,
193201
warpTimer: state.scratchGui.tw.compilerOptions.warpTimer,
194202
customStageSize: state.scratchGui.customStageSize,

src/lib/project-fetcher-hoc.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const ProjectFetcherHOC = function (WrappedComponent) {
120120
) {
121121
this.props.vm.setFramerate(30);
122122
this.props.vm.setRuntimeOptions({
123+
disableDirectionClamping: false,
123124
dangerousOptimizations: false,
124125
disableOffscreenRendering: false,
125126
fencing: true,

src/lib/tw-state-manager-hoc.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ const TWStateManager = function (WrappedComponent) {
405405
});
406406
}
407407

408+
if (urlParams.has('nodirectionclamping')) {
409+
this.props.vm.setRuntimeOptions({
410+
disableDirectionClamping: true
411+
});
412+
}
413+
408414
for (const extension of urlParams.getAll('extension')) {
409415
this.props.vm.extensionManager.loadExtensionURL(extension);
410416
}
@@ -535,6 +541,12 @@ const TWStateManager = function (WrappedComponent) {
535541
searchParams.delete('nooffscreen');
536542
}
537543

544+
if (runtimeOptions.disableDirectionClamping) {
545+
searchParams.set('nodirectionclamping', '');
546+
} else {
547+
searchParams.delete('nodirectionclamping');
548+
}
549+
538550
setSearchParams(searchParams);
539551
}
540552
}

src/reducers/tw.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const initialState = {
3434
miscLimits: true,
3535
dangerousOptimizations: false,
3636
disableOffscreenRendering: false,
37+
disableDirectionClamping: false,
3738
fencing: true
3839
},
3940
isWindowFullScreen: false,

0 commit comments

Comments
 (0)