Skip to content

Commit cf1d8d2

Browse files
committed
implement scaling factor to bars to use whole screen width
1 parent 179cc21 commit cf1d8d2

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/aperture/apertureTexture.m

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@
119119
% Draw aperture and we rotate to match the required condition
120120
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture, ...
121121
cfg.screen.winRect, ...
122-
cfg.screen.winRect, ...
122+
CenterRect(...
123+
cfg.screen.winRect * cfg.magnify.scalingFactor, ...
124+
cfg.screen.winRect), ...
123125
thisEvent.condition - 90);
124126
else
125127

@@ -163,13 +165,29 @@
163165
end
164166

165167
case 'bar'
168+
169+
extraPositons = 0;
170+
if cfg.magnify.do
171+
% we add some extra bar positions that we remove afterwards to
172+
% prevent having nothing on screen for a long time
173+
extraPositons = 12;
174+
end
166175

167176
% Set parameters drifting bars
168-
cfg.aperture.barWidthPix = cfg.stimRect(3) / cfg.volsPerCycle;
169-
cfg.aperture.barPosPix = ...
177+
cfg.aperture.barWidthPix = cfg.stimRect(3) / (cfg.volsPerCycle + extraPositons);
178+
179+
barPosPix = ...
170180
[0:cfg.aperture.barWidthPix:cfg.stimRect(3) - cfg.aperture.barWidthPix] + ...
171181
(cfg.screen.winRect(3) / 2 - cfg.stimRect(3) / 2) + ...
172182
cfg.aperture.barWidthPix / 2; %#ok<NBRAK>
183+
184+
% Those positions are removed because they are actually outside of
185+
% the screen when magnification (fit to windows width) is on
186+
if cfg.magnify.do
187+
barPosPix([1:6, end-5:end]) = [];
188+
end
189+
190+
cfg.aperture.barPosPix = barPosPix;
173191

174192
% Width of bar in degrees of VA (needed for saving)
175193
cfg.aperture.width = cfg.aperture.barWidthPix / cfg.screen.ppd;

0 commit comments

Comments
 (0)