@egjs/flicking 4.9.0 → 4.9.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.9.0",
3
+ "version": "4.9.3-beta.0",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.js",
6
6
  "module": "dist/flicking.esm.js",
@@ -23,7 +23,7 @@
23
23
  "test": "npm run test --prefix test/unit",
24
24
  "test:chrome": "npm run test:chrome --prefix test/unit",
25
25
  "test:cfc": "npm run test --prefix test/cfc",
26
- "lint": "eslint 'src/**/*.ts'",
26
+ "lint": "eslint src/**/*.ts",
27
27
  "lint:test": "eslint 'test/unit/**/*.ts'",
28
28
  "jsdoc": "jsdoc -c jsdoc.json",
29
29
  "jsdoc:watch": "npm-watch jsdoc",
@@ -136,7 +136,7 @@
136
136
  "typescript-transform-paths": "^2.2.3"
137
137
  },
138
138
  "dependencies": {
139
- "@egjs/axes": "^3.2.2",
139
+ "@egjs/axes": "^3.8.0",
140
140
  "@egjs/component": "^3.0.1",
141
141
  "@egjs/imready": "^1.1.3",
142
142
  "@egjs/list-differ": "^1.0.0"
package/src/Flicking.ts CHANGED
@@ -1084,6 +1084,10 @@ class Flicking extends Component<FlickingEvents> {
1084
1084
  return Promise.reject(new FlickingError(ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING, ERROR.CODE.ANIMATION_ALREADY_PLAYING));
1085
1085
  }
1086
1086
 
1087
+ if (this._control.holding) {
1088
+ this._control.controller.release();
1089
+ }
1090
+
1087
1091
  return this._control.moveToPanel(panel, {
1088
1092
  duration,
1089
1093
  direction
@@ -1502,11 +1506,12 @@ class Flicking extends Component<FlickingEvents> {
1502
1506
  const renderer = this._renderer;
1503
1507
  const control = this._control;
1504
1508
  const camera = this._camera;
1505
- const initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
1509
+ const defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
1506
1510
 
1507
- if (!initialPanel) return;
1511
+ if (!defaultPanel) return;
1508
1512
 
1509
- const nearestAnchor = camera.findNearestAnchor(initialPanel.position);
1513
+ const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
1514
+ const initialPanel = (nearestAnchor && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
1510
1515
  control.setActive(initialPanel, null, false);
1511
1516
 
1512
1517
  if (!nearestAnchor) {
@@ -202,6 +202,18 @@ class AxesController {
202
202
  return this;
203
203
  }
204
204
 
205
+ /**
206
+ * Releases ongoing user input (mouse/touch)
207
+ * @ko 사용자의 현재 입력(마우스/터치)를 중단시킵니다
208
+ * @chainable
209
+ * @return {this}
210
+ */
211
+ public release(): this {
212
+ this._panInput?.release();
213
+
214
+ return this;
215
+ }
216
+
205
217
  /**
206
218
  * Update {@link https://naver.github.io/egjs-axes/ @egjs/axes}'s state
207
219
  * @ko {@link https://naver.github.io/egjs-axes/ @egjs/axes}의 상태를 갱신합니다
@@ -161,6 +161,18 @@ abstract class Control {
161
161
  return this;
162
162
  }
163
163
 
164
+ /**
165
+ * Releases ongoing user input (mouse/touch)
166
+ * @ko 사용자의 현재 입력(마우스/터치)를 중단시킵니다
167
+ * @chainable
168
+ * @return {this}
169
+ */
170
+ public release(): this {
171
+ this._controller.release();
172
+
173
+ return this;
174
+ }
175
+
164
176
  /**
165
177
  * Update position after resizing
166
178
  * @ko resize 이후에 position을 업데이트합니다
@@ -308,7 +308,7 @@ class Panel {
308
308
  */
309
309
  public resize(cached?: {
310
310
  size: number;
311
- height: number;
311
+ height?: number;
312
312
  margin: { prev: number; next: number };
313
313
  }): this {
314
314
  const el = this.element;
@@ -321,7 +321,13 @@ class Panel {
321
321
  if (cached) {
322
322
  this._size = cached.size;
323
323
  this._margin = { ...cached.margin };
324
- this._height = cached.height;
324
+ this._height = cached.height ?? getElementSize({
325
+ el,
326
+ horizontal: false,
327
+ useFractionalSize,
328
+ useOffset: true,
329
+ style: getStyle(el)
330
+ });
325
331
  } else {
326
332
  const elStyle = getStyle(el);
327
333
 
@@ -496,8 +496,8 @@ abstract class Renderer {
496
496
  : { height: panelSize };
497
497
  const firstPanelSizeObj = {
498
498
  size: panelSize,
499
- height: referencePanel.height,
500
- margin: referencePanel.margin
499
+ margin: referencePanel.margin,
500
+ ...(!flicking.horizontal && { height: referencePanel.height})
501
501
  };
502
502
 
503
503
  if (!flicking.noPanelStyleOverride) {
package/TODO.md DELETED
@@ -1,3 +0,0 @@
1
- ## React 18 대응
2
- - [] updateoffset을 미루기
3
- - render가 완료되기 전에 updateOffset이 3번 호출되었음