Skip to content

Commit 39f1d55

Browse files
committed
resolved some comments
1 parent 97dc3c4 commit 39f1d55

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/dd-draggable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
402402
: (-event.clientX + targetOffset.left - xformOffsetX);
403403

404404
return {
405-
x: x,
405+
x,
406406
top: targetOffset.top,
407-
offsetX: offsetX,
407+
offsetX,
408408
offsetTop: - event.clientY + targetOffset.top - xformOffsetY,
409409
width: targetOffset.width * this.dragTransform.xScale,
410410
height: targetOffset.height * this.dragTransform.yScale

src/gridstack.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
.grid-stack > .grid-stack-item {
2929
position: absolute;
3030
padding: 0;
31-
top: 0;
31+
top: 0; // some default to reduce at least first row inline styles
3232
width: var(--gs-column-width); // reduce 1x1 items inline styles
3333
height: var(--gs-cell-height);
3434

@@ -45,10 +45,10 @@
4545
}
4646

4747
.grid-stack:not(.grid-stack-rtl) > .grid-stack-item {
48-
left: 0; // some default to reduce at least first row/column inline styles
48+
left: 0; // some default to reduce at least first column inline styles
4949
}
5050
.grid-stack.grid-stack-rtl > .grid-stack-item {
51-
right: 0; // some default to reduce at least first row/column inline styles
51+
right: 0; // some default to reduce at least first column inline styles
5252
}
5353

5454
.grid-stack {

src/gridstack.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ export class GridStack {
224224
/** @internal true if we got created by drag over gesture, so we can removed on drag out (temporary) */
225225
public _isTemp?: boolean;
226226

227-
private isRtl = false;
228-
229227
/**
230228
* @internal create placeholder DIV as needed
231229
* @returns the placeholder element for indicating drop zones during drag operations
@@ -335,7 +333,6 @@ export class GridStack {
335333
if (opts.rtl) {
336334
this.el.classList.add('grid-stack-rtl');
337335
}
338-
this.isRtl = opts.rtl;
339336

340337
// check if we're been nested, and if so update our style and keep pointer around (used during save)
341338
const parentGridItem: GridItemHTMLElement = this.el.closest('.' + gridDefaults.itemClass);
@@ -1924,7 +1921,7 @@ export class GridStack {
19241921
protected _writePosAttr(el: HTMLElement, n: GridStackNode): GridStack {
19251922
// Avoid overwriting the inline style of the element during drag/resize, but always update the placeholder
19261923
if ((!n._moving && !n._resizing) || this._placeholder === el) {
1927-
const xProp = this.isRtl ? 'right' : 'left';
1924+
const xProp = this.opts.rtl ? 'right' : 'left';
19281925
// width/height:1 x/y:0 is set by default in the main CSS, so no need to set inlined vars
19291926
el.style.top = n.y ? (n.y === 1 ? `var(--gs-cell-height)` : `calc(${n.y} * var(--gs-cell-height))`) : null;
19301927
el.style[xProp] = n.x ? (n.x === 1 ? `var(--gs-column-width)` : `calc(${n.x} * var(--gs-column-width))`) : null;
@@ -2803,12 +2800,12 @@ export class GridStack {
28032800
start: onStartMoving,
28042801
stop: onEndMoving,
28052802
drag: dragOrResize,
2806-
rtl: this.isRtl,
2803+
rtl: this.opts.rtl,
28072804
}).resizable(el, {
28082805
start: onStartMoving,
28092806
stop: onEndMoving,
28102807
resize: dragOrResize,
2811-
rtl: this.isRtl,
2808+
rtl: this.opts.rtl,
28122809
});
28132810
node._initDD = true; // we've set DD support now
28142811
}

0 commit comments

Comments
 (0)