Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"lib-start": "ng build angular-split --watch",
"lint": "ng lint",
"app_build": "yarn lib_build && ng build --configuration production --base-href /angular-split/",
"app_analyze": "yarn lib_build && ng build --configuration production --stats-json && webpack-bundle-analyzer dist/angular-split-app/stats.json",
Expand Down
6 changes: 5 additions & 1 deletion projects/angular-split/src/lib/component/split.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,13 @@ export class SplitComponent implements AfterViewInit, OnDestroy {

let offset =
this.direction === 'horizontal' ? this.startPoint.x - this.endPoint.x : this.startPoint.y - this.endPoint.y
if (this.dir === 'rtl') {

// RTL requires negative offset only in horizontal mode as in vertical
// RTL has no effect on drag direction.
if (this.dir === 'rtl' && this.direction === 'horizontal') {
offset = -offset
}

const steppedOffset = Math.round(offset / this.gutterStep) * this.gutterStep

if (steppedOffset === this.snapshot.lastSteppedOffset) {
Expand Down
10 changes: 9 additions & 1 deletion src/app/examples/dir-rtl/dir-rtl.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ import { AComponent } from '../../ui/components/AComponent'
align-items: center;
flex-wrap: wrap;
}

.btns > button:not(:last-child) {
margin-right: 10px;
}
`,
],
template: `
{{ testChangeDetectorRun() }}
<div class="container">
<sp-example-title [type]="exampleEnum.DIR"></sp-example-title>
<div class="split-example">
<as-split [dir]="dir">
<as-split [dir]="dir" [direction]="direction">
<as-split-area size="20">
<p>
1. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tiam, quis nostrud exercitation
Expand Down Expand Up @@ -62,10 +66,14 @@ import { AComponent } from '../../ui/components/AComponent'
<button class="btn btn-warning" (click)="dir = dir === 'rtl' ? 'ltr' : 'rtl'">
{{ 'Toggle dir: "' + dir + '"' }}
</button>
<button class="btn btn-warning" (click)="direction = direction === 'vertical' ? 'horizontal' : 'vertical'">
{{ 'Toggle direction: "' + direction + '"' }}
</button>
</div>
</div>
`,
})
export class DirRtlComponent extends AComponent {
dir = 'rtl'
direction = 'horizontal'
}